in reply to How to convert a string with regex to a string with a fixed length?
s/\b(\d+)\b/sprintf "%013d", $1/eg;
If not, please tell us exactly what you can use - a single regular expression only matches stuff, but can't change the source string.
Update: I missed that the 0's should actually be appended at the end. You can try to use lodin's solution inside the substitution part, though. Or to rescue my original solution:
s/\b(\d+)\b/reverse sprintf "%013d", scalar reverse $1/eg;
|
|---|