![]() |
|
Welcome to the Monastery | |
PerlMonks |
Re^2: what is the best way to seperate the digits and strings from variable ?by dbwiz (Curate) |
on May 09, 2005 at 10:58 UTC ( #455142=note: print w/replies, xml ) | Need Help?? |
Please, test your code. \d* will match 0 (ZERO) or more digits. Thus, it will happily match an empty string at the beginning of a string like "abc123" and return a 0 length string. Try it. The right expression to use in this case is \d+. Moreover, a capturing regular expression should always be used with a test:
In Section
Seekers of Perl Wisdom
|
|