WarrenBullockIII has asked for the wisdom of the Perl Monks concerning the following question:
However, the book lists the code like this:/\bfred|wilma\s+flintstone\b/
I do not understand why the parenthesis are needed here. But I do see that if I take them away it causes problems because if I type just flintstone at the prompt it will not match. However, if I leave the parenthesis in the pattern as the book does than flintstone will match... could someone please clarify this for me../\b(fred|wilma)\s+flintstone\b/
-Warren E Bullock III wbullock@twcny.rr.com
Edit kudra, 2002-06-08 Changed title, added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Regular Expressions
by merlyn (Sage) on Jun 08, 2002 at 03:06 UTC | |
|
Re: Regular Expressions
by mephit (Scribe) on Jun 08, 2002 at 03:39 UTC | |
|
Re: Regular Expressions
by BUU (Prior) on Jun 08, 2002 at 03:19 UTC | |
by stefp (Vicar) on Jun 08, 2002 at 04:17 UTC | |
|
Re: Parenthesis usage in Regular Expressions
by Molt (Chaplain) on Jun 08, 2002 at 21:44 UTC |