|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re^4: Removing digits from a stringby Athanasius (Vicar) |
| on Jan 01, 2013 at 13:38 UTC ( #1011152=note: print w/ replies, xml ) | Need Help?? |
|
s/^\D*\d+// # 'first few digits' Even if this interpretation is correct (and I agree with erix that it’s unlikely), there is no warrant in the OP to remove the non-digit prefix. So the regex would need to be: s/^(\D*)\d+/$1/. For example:
Update (2nd January, 2013): Thank-you Anonymous Monk for the improvement below using \K: shorter and “much more efficient”, according to perlre. I’ve learned something useful! Hope that helps,
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||