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
In reply to Re: delayed variable interpolation in a regular expression
by johngg
in thread delayed variable interpolation in a regular expression
by wannabeperlie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |