throop has asked for the wisdom of the Perl Monks concerning the following question:
I'm running Perl 5.8.6. I'm trying to pattern match some comma-delimited phrases in text. The phrases can have multiple words, plus the following punct:
( ) < > -
I'm using square braces in a regex, and seeing the following behavior that I don't understand (running in the interpreter within the debugger):
Why am I matching the trailing comma in the first case but not the second? Is the matching within square braces supposed to be order-dependent? None of the refs I've looked at mention it.DB<116> x 'cold, too cold' =~ /( [\(\)-<>\w]+ )/x 0 'cold,' DB<117> x 'cold, too cold' =~ /( [-<>\w\(\)]+ )/x 0 'cold'
throop
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Order of terms in square braces
by imp (Priest) on Feb 03, 2007 at 00:44 UTC | |
by TOD (Friar) on Feb 03, 2007 at 05:10 UTC | |
by ikegami (Patriarch) on Feb 03, 2007 at 07:12 UTC | |
by throop (Chaplain) on Feb 05, 2007 at 19:37 UTC | |
|
Re: Order of terms in square braces
by BrowserUk (Patriarch) on Feb 03, 2007 at 00:51 UTC |