For the third point, I was just meaning that you don't need the parenthesis. But I was totally wrong (as AnomalousMonk pointed out to me), as I missed that you *are* using the capture group as the key to the hash for your replacement. As you can see, we *all* make mistakes! ;^)
Your latest version looks good.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re^4: problem with substitute in regexp
by roboticus
in thread problem with substitute in regexp
by upaksh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |