in reply to One regex construct to handle multiple string types
In case of input of "2L", \w* eats the "2". As input string does not have an optional dot, you are left with "L" as required by \S+, which is then printed.
Given the example strings, make preceding word letters AND the dot a single combination which is optional: m/ (?: \w+[.] )? (\S+) /x.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: One regex construct to handle multiple string types
by pobocks (Chaplain) on Nov 29, 2008 at 10:22 UTC | |
by Krambambuli (Curate) on Nov 29, 2008 at 10:41 UTC | |
by pobocks (Chaplain) on Nov 29, 2008 at 10:46 UTC | |
by ww (Archbishop) on Nov 29, 2008 at 12:34 UTC | |
by JadeNB (Chaplain) on Nov 30, 2008 at 18:38 UTC |
In Section
Seekers of Perl Wisdom