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.
In reply to Re: One regex construct to handle multiple string types
by parv
in thread One regex construct to handle multiple string types
by neversaint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |