kiat has asked for the wisdom of the Perl Monks concerning the following question:
$pattern = 'match'; @array = ('hello', 'matched', 'match', 123, 'sleep'); foreach (@array) { # Matched 'match' but not 'matched' print "$1\n" if /\b($pattern)\b/; #print "$1\n" if /(\b$pattern\b)/; }
Should I put the '\b' inside the brackets or outside them? Please advise and thanks in advance :)
Edited 2001-11-02 by Ovid
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regular expression
by blakem (Monsignor) on Nov 03, 2001 at 06:25 UTC | |
|
Re: regular expression
by staeryatz (Monk) on Nov 03, 2001 at 07:34 UTC | |
|
Re: regular expression
by hopes (Friar) on Nov 03, 2001 at 17:34 UTC | |
|
Re: regular expression
by kiat (Vicar) on Nov 06, 2001 at 16:40 UTC |