in reply to Extraction number from Text
The (?:.....) construct allows paranthetical constraining without capturing.
my @qty = 'GARNIER DEODORANT MINERALS - DRY CARE (50OZ)' =~ m/ \( ([+-\d.eE]*\d+) (?:KG|OZ|CL|LT|LTR|M)\b \) /igx;
I also made a couple of functional changes to your RE, which may or may not be appropriate, but which I suspect are in keeping with what you're after:
Have a look at perlre for a description of both (?:....) and the /x modifier.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extraction number from Text
by moritz (Cardinal) on Jun 14, 2010 at 08:44 UTC | |
by davido (Cardinal) on Jun 14, 2010 at 08:50 UTC | |
by JavaFan (Canon) on Jun 14, 2010 at 10:08 UTC | |
by proceng (Scribe) on Jun 14, 2010 at 13:51 UTC | |
|
Re^2: Extraction number from Text
by Anonymous Monk on Jun 14, 2010 at 08:41 UTC |