You have the wrong order of replacements. Do replacement 4|5 first; then 1 (2|3 are obtained for free).
In reply to Re: Avoid recursive replacement using regex
by parv
in thread Avoid recursive replacement using regex
by anirudhkumar_r
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |