Re: Preventing null string from matching

2003-03-26 Thread Rob Dixon
John W. Krahn wrote: > Rob Dixon wrote: > > > > John W. Krahn wrote: > > > > > > Better to use zero-width positive look-ahead and look-behind. > > > > > > $ perl -le' > > > $_ = ":B000:L520:M260:M:88:8:M602:"; > > > $string_to_match = qr/\w+/; > > > $count = () = /(?<=:)$string_to_match(?=:)/g; > >

Re: Preventing null string from matching

2003-03-26 Thread John W. Krahn
Rob Dixon wrote: > > John W. Krahn wrote: > > > > Using a character class like \W won't work properly if $string_to_match > > is non-null. > > > > $ perl -le' > > $_ = ":B000:L520:M260:M:88:8:M602:"; > > $string_to_match = qr/\w+/; > > $count = () = /\b$string_to_match\b/g; > > print $count; > > '

Re: Preventing null string from matching

2003-03-25 Thread scott . e . robinson
; cc: Subject: Re: Preventing null string from matching

Re: Preventing null string from matching

2003-03-25 Thread Rob Dixon
John W. Krahn wrote: > Rob Dixon wrote: > > > > my @match = /\W($string_to_match)\W/g; > > my $count =- @match; > > Using a character class like \W won't work properly if $string_to_match > is non-null. > > $ perl -le' > $_ = ":B000:L520:M260:M:88:8:M602:"; > $string_to_match = qr/\w+/; > $

Re: Preventing null string from matching

2003-03-25 Thread John W. Krahn
Rob Dixon wrote: > > Scott E Robinson wrote: > > > > I don't exactly want to ask this now, since I just spent much of the > > evening trying to handle this case, but I wonder if there's an easy > > way to > > keep the following regular expression from matching if the string in > > the > > regex i

Re: Preventing null string from matching

2003-03-25 Thread Rob Dixon
Scott E Robinson wrote: > > I wasn't complaining about working all evening, by the way -- just > highlighting how little I know about Perl since a little thing like that > can keep me here all night! And I was sympathising, not apologising: I've been there too! Cheers, Rob -- To unsubscribe

Re: Preventing null string from matching

2003-03-25 Thread scott . e . robinson
.co.uk> cc: Subject: Re: Preventing null string from matching

Re: Preventing null string from matching

2003-03-25 Thread Rob Dixon
Scott E Robinson wrote: > Dear Perl communinty, > > I don't exactly want to ask this now, since I just spent much of the > evening trying to handle this case, but I wonder if there's an easy > way to > keep the following regular expression from matching if the string in > the > regex is null: > >

Re: Preventing null string from matching

2003-03-25 Thread Rob Dixon
Scott E Robinson wrote: > Dear Perl communinty, > > I don't exactly want to ask this now, since I just spent much of the > evening trying to handle this case, but I wonder if there's an easy > way to > keep the following regular expression from matching if the string in > the > regex is null: > >

Re: Preventing null string from matching

2003-03-25 Thread Steve Grazzini
Scott E Robinson <[EMAIL PROTECTED]> wrote: > > [...] I wonder if there's an easy way to keep the following > regular expression from matching if the string in the regex > is null: > > $_ = ":B000:L520:M260:M:88:8:M602:"; > $string_to_match="whatever"; > $count = () = /\b($string_to_match)\b/g;

Preventing null string from matching

2003-03-24 Thread scott . e . robinson
Dear Perl communinty, I don't exactly want to ask this now, since I just spent much of the evening trying to handle this case, but I wonder if there's an easy way to keep the following regular expression from matching if the string in the regex is null: $_ = ":B000:L520:M260:M:88:8:M602:"; $str