in reply to Removing digits from a string
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:
23:21 >perl -wE "$f = 'xyz20130101Customer100.imp'; $f =~ s/^(\D*)\d+/
+$1/; say $f;"
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,
That's likely not the right interpretation of his use of 'truncate', which suggests outer positions, no? But I guess the OP should be able to 'figure' it out ;-)
.desrever si txet eritne ehT
.backwards are (letters the not but) words the Only
ehT sdrow era ni redro, tub eht srettel era eht rehto yaw.
Who ndees baacdkrws wehn you have Tceilmopgyya?
?wdors reeersvd up meixd about How
.tusnnmihep rof nuttolg a m'I
Results (441 votes). Check out past polls.