It seems you have your solution. However, I see you're still including the '^' character in your inverted character class; is this what you want? See example below.
c:\@Work\Perl>perl -wMstrict -le "$_ = 'a { b } c { d^ } e {{F}} {{^G}}'; ;; s/\{([^{^}]+)\}/ lbracket $1 rbracket /g; print qq{'$_'}; " 'a lbracket b rbracket c { d^ } e { lbracket F rbracket } {{^G}}'
In reply to Re^3: Regex - Is there any way to control when the contents of a variable are interpolated? (Using "$1" and '$1' in regex replacements)
by AnomalousMonk
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: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |