Hi, Bob, :)
Thanks for the detailed response! I figured I was on the right path,
but confirmation greatly appreciated. :)
On Mon, 17 Sep 2001, Bob Showalter wrote:
> Now, can you tell why '~' is matched by
>
>/(?:^|[^~])~$/
Because the '(?:re1|re2)' is a zero-length, non-capturing anchor
> -Original Message-
> From: Jason Tiller [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 14, 2001 5:41 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Matching a pattern only once
>
>
> Hello, Again, Bob, :)
>
> On Fri, 14 Sep 2001, Bob
> my $filename = $File::Find::name;
> if ($filename =~ /(\~){1}$/) {
> # do something
> }
What you are doing here is matching only ~ as the entire filename.
You should try
$filename =~ /^[~]/
This looks for a character (~ in this case) at the beginning of the
string. Since you're not interest
Hello, Again, Bob, :)
On Fri, 14 Sep 2001, Bob Showalter wrote:
> You can use look-behind assertion:
>
>/(? Which means, match a tilde, not preceded by a tilde, anchored to the
> end of the string. This will match:
>foo~
>~
>
> But not:
>
>foo~~
>~~
I'm trying to understand
--- Stefan Rotsch <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've got trouble with matching a character only once. The function
>
> my $filename = $File::Find::name;
> if ($filename =~ /(\~){1}$/) {
> # do something
> }
>
> should be used for deleting temporary files ending with a ~. Because
>
> -Original Message-
> From: Stefan Rotsch [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 14, 2001 1:55 PM
> To: [EMAIL PROTECTED]
> Subject: Matching a pattern only once
>
>
> Hi,
>
> I've got trouble with matching a character only once. The
Hi,
I've got trouble with matching a character only once. The function
my $filename = $File::Find::name;
if ($filename =~ /(\~){1}$/) {
# do something
}
should be used for deleting temporary files ending with a ~. Because
of some special files ending with ~~ I would like to keep the above