Desired behavior:
'a { b } c ( d ) e {{F}} ((G))'; should change to
'a lbracket b rbracket c ( d ) e { lbracket F rbracket } ((G))';
Using something like print s/\{([^\}^\}]+)\}/ lbracket $1 rbracket /g . " pairs of brackets replaced with lbracket rbracket.\n"
works, but when I got the idea in my head that I wanted a subroutine to handle this for me (for legibility and debugging), I couldn't let it go.
In reply to Re^2: Regex - Is there any way to control when the contents of a variable are interpolated? (Using "$1" and '$1' in regex replacements)
by JDoolin
in thread Regex - Is there any way to control when the contents of a variable are interpolated? (Using "$1" and '$1' in regex replacements)
by JDoolin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |