in reply to Extraction number from Text
Now, how can I use OR i.e. | symbol without having to code them between brackets.
I'm not sure I understand your question.
You need some form of bracketing construct to group the alternatives, because | has a rather loose precedence.
If the precedence was tigther than concatenation, KG|OZ|CL would be parsed as K(G|O)(Z|C)L which you wouldn't like either.
If you want to avoid the capturing (ie that (...) associates the matched text with $1, $2 etc.) you can use (?:...) instead of (...). That also does the grouping, but doesn't capture.
See perlretut and perlre for more information.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extraction number from Text
by Anonymous Monk on Jun 14, 2010 at 08:23 UTC |