XP is just a number | |
PerlMonks |
Re: When greedy constructs do battle, can I choose the winner?by ikegami (Patriarch) |
on Sep 20, 2007 at 18:55 UTC ( [id://640213]=note: print w/replies, xml ) | Need Help?? |
Yes, by placing it first.
But note that I had to add (?>...) in order to prevent backtracking in the situation where the input is "0000". It's simpler to make sure the last of 5 isn't a 0.
or
In all of the above solutions, $last_five will be undef if there's no match. Tested.
In Section
Seekers of Perl Wisdom
|
|