To extend what JavaFan is saying, you can use the s/// operator in place of the test and substitute. In your example there doesn't seem to be any reason to test the string first.
In reply to Re^2: Replacing exactly the found instance in REGEX
by gwadej
in thread Replacing exactly the found instance in REGEX
by inquis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |