in reply to delayed variable interpolation in a regular expression
my $match = 'System\s+has\s+tool\s+([0-9a-zA-Z_-]+)\s+version\s+(.*)';
you have a character class [0-9a-zA-Z_-] but if you are intending that a hyphen is part of the class you must place it first in the class like this [-0-9a-zA-Z_]. Anywhere else in the class the hyphen denotes a range so your one is a class of 0 to 9, a to z, A to Z and underscore to nothing.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: delayed variable interpolation in a regular expression
by Hue-Bond (Priest) on Apr 25, 2006 at 10:18 UTC | |
by SamCG (Hermit) on Apr 25, 2006 at 16:03 UTC | |
by johngg (Canon) on Apr 25, 2006 at 10:34 UTC |