RE: Matching a pattern only once

2001-09-17 Thread Jason Tiller
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

RE: Matching a pattern only once

2001-09-17 Thread Bob Showalter
> -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

Re: Matching a pattern only once

2001-09-14 Thread Akshay Arora
> 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

RE: Matching a pattern only once

2001-09-14 Thread Jason Tiller
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

Re: Matching a pattern only once

2001-09-14 Thread Curtis Poe
--- 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 >

RE: Matching a pattern only once

2001-09-14 Thread Bob Showalter
> -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

Matching a pattern only once

2001-09-14 Thread Stefan Rotsch
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