A substitution substitutions not only the captured part of the string, but the matched part of the string. Using zero-width assertion you can reduce the matched part of the string to the captured part.
In reply to Re: regexp: non-capturing grouping in replacement possible?
by moritz
in thread regexp: non-capturing grouping in replacement possible?
by diweooy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |