You are advocating building small patterns so that they can be combined into larger patterns, right? If so, your code is buggy (and I don't mean just the superfluous (?:)).
>perl -E"$sqr=qr/\[.*?\]/; $_='ab[cd]ef[gh]'; s/$sqr$//; say" ab
Fixed:
>perl -E"$sqr=qr/\[[^\[\]]*\]/; $_='ab[cd]ef[gh]'; s/$sqr$//; say" ab[cd]ef
In reply to Re^2: Advanced replace function
by ikegami
in thread Advanced replace function
by sans-clue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |