in reply to Re: Only sometimes deprecated? "Unescaped left brace in regex is deprecated"
in thread Only sometimes deprecated? "Unescaped left brace in regex is deprecated"

Thanks! :)

hmm, the perldelta doesn't talk about quantifiers, and the ambiguity would already have existed before.

I thought it's deprecated to facilitate parsing extended syntax like /abc(?{print "Hi Mom!";})def/

see perlretut for other examples

so I'm not sure if it's about quantifiers...

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re^2: Only sometimes deprecated? "Unescaped left brace in regex is deprecated"
  • Download Code

Replies are listed 'Best First'.
Re^3: Only sometimes deprecated? "Unescaped left brace in regex is deprecated"
by Eily (Monsignor) on Jun 02, 2017 at 16:37 UTC

    Because (? is invalid syntax on its own, in any (?X pattern the X is unambiguously special or incorrect, but never litteral. perlre however does talk about extending the quantifier syntax.

    like making the lower bound of a quantifier optional
    And any new syntax that's not a modifier can be added with a (?X pattern. That's why I concluded that disallowing unescaped litteral { was probably an opening toward new quantifier syntax (because { only introduces quantifiers). I thought of something like /.{{!($_ % 3)}}/ instead of /(?:.{3})*/ (it's harder to read though ...), or even "3ABCD" =~ /(\d)(.{{$1}})(.*)/; #(3,"ABC", "D"). But that's wild guesswork

    PS: How do you like all those unbalanced left tokens? ^^"

      Thanks, in hindsight all these explanations and reasonings make sense.

      I just expect documentation to be clearer.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!