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)
in thread Regex - Is there any way to control when the contents of a variable are interpolated? (Using "$1" and '$1' in regex replacements)

my $nobrackets = qr/[^\{^\}]+/;

A peripheral problem, but please take another look at choroba's second point above. Please see Character Classes and other Special Escapes in perlre, also discussions of character classes in Using character classes in perlrequick, and more extensively Using character classes in perlretut.

  • Comment on Re^3: Regex - Is there any way to control when the contents of a variable are interpolated? (Using "$1" and '$1' in regex replacements)
  • Download Code

Replies are listed 'Best First'.
Re^4: Regex - Is there any way to control when the contents of a variable are interpolated? (Using "$1" and '$1' in regex replacements)
by JDoolin (Novice) on Mar 15, 2014 at 18:58 UTC

    Yes, I misunderstood his comment above.

    "2. In character classes (inside square brackets in a regex) you do not have to backslash brackets. ^ on the non-first position in a character class stands for itself."

    When I read 'you do not have to...' I understood that the backslashes are optional, but decided I liked to use them anyway. I completely missed his more important point here, that the repeated ^ actually negates the ^ character.