Chris Spurgeon on Tue, 22 Feb 2000 17:30:55 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Can I ask a quick stupid question?


Clever, thanks!


On Tue, 22 Feb 2000, Nicolai Rosen wrote:

> That's because it's trying to match the last character of $searcher 1 or
> more times. Then it's trying to repeat this procedure twice, but w/ 1 or
> more nothings. You want the escape character \+. Of course since you're
> doing this for 3 of them & it is w/ a variable, the easiest way to do this
> would be to use the \Q escape sequence. It disables all metacharacters.
> You end it w/ \E. So here's the regexp test all fixed up:
> $teststring =~ /\Q$alteredsearcher\E/
> 
> On Tue, 22 Feb 2000, Chris Spurgeon wrote:
> > OK, I have this code.....
> > 
> > #!/usr/bin/perl
> > 
> > @group1 = qw(foo foofoo foo+++ bar bar+++ foobar);
> > @group2 = qw(foo bar);
> > 
> > foreach $teststring (@group1) {
> >     foreach $searcher (@group2) {
> >         $alteredsearcher = $searcher . "+++";
> >         if ($teststring =~ /$alteredsearcher/) {
> >             print "Got a match with $teststring and $searcher\n";
> >         }
> >     }
> > }
> > 
> > 
> > ... what I'm trying to do here is search for a series of strings, where
> > the strings happen to end with the characters "+++".  But perl is picking
> > up those final characters in $alteredsearcher and it's seeing them as a
> > syntax error instead of just three characters. What am I missing here?
> > TIA.
> > 
> > 
> > _____________________________________________________________
> > Chris Spurgeon     |  "So much time,...so little to do."  
> > WHYY webmaster     |                     -- Stan Laurel
> > ces@www.whyy.org   |  
> > http://whyy.org    |  
> > 
> > **Majordomo list services provided by PANIX <URL:http://www.panix.com>**
> > **To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
> > 
> 
> Nicolai Rosen
> nick@netaxs.com
> Earthstation/Netaxs
> 
> **Majordomo list services provided by PANIX <URL:http://www.panix.com>**
> **To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
> 

_____________________________________________________________
Chris Spurgeon     |  "So much time,...so little to do."  
WHYY webmaster     |                     -- Stan Laurel
ces@www.whyy.org   |  
http://whyy.org    |  

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**