[0-9] matches exactly one digit, so the first match is f1 and $1 is 1. There's no such hash key, so it interpolates undef, which stringifies to the empty string.
It would help to write ([0-9]+) or ([0-9]{3}), depending on what your data looks like.
In reply to Re: problem with substitute in regexp
by moritz
in thread problem with substitute in regexp
by upaksh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |