Perl: the Markov chain saw | |
PerlMonks |
Re^2: How can i extract a number from an stringby johngg (Canon) |
on Jan 22, 2009 at 14:57 UTC ( [id://738179]=note: print w/replies, xml ) | Need Help?? |
An alternative to JavaFan's use of a capture in the split regexp could be to use look-arounds to do the split at points where the string changes from non-digit to digit and vice-versa. I think JavaFan's method is better in this case but the look-arounds can sometimes be a useful technique.
I hope this is of interest. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|