This was a change made by Karl, but personally i consider this discrepancy to be undesirable. Karl would have to confirm the intent here however. Yves On 22 May 2016 20:28, "James E Keenan via RT" <perlbug-followup@perl.org> wrote: On Sun May 22 13:14:54 2016, wyant wrote: > This is a bug report for perl from wyant@cpan.org, > generated with the help of perlbug 1.40 running under perl 5.24.0. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > As I understand it, literal left curly brackets in regular expressions > were deprecated in Perl 5.22, and with Perl 5.25.1 they produced a > compile error. However, it appears that there is no warning (under > 5.24.0) or error (under 5.25.1) for the following: > > /.{/ > /[x]{/ > /[xy]{/ > /\p{Latin}{/ > > Compilation of these under 'use re debug' appears to show that the > curlys are compiled as literals. Examples of this are appended. I note > that /x(?:{)/ also produces no warning/exception, but I understand > this > to be an instance of the exception for leading curlys. > > Is all this a misunderstanding of the deprecation on my part? Or an > obscure code path missed in the deprecation? If the former, please > accept my apologies for wasting your time. And in either case, thank > you > very much for making Perl what it is today. > > Appended example: > > $ perl -c -Mre=debug -e '/.{/' > Compiling REx ".{" > Final program: > 1: REG_ANY (2) > 2: EXACT <{> (4) > 4: END (0) > anchored "{" at 1 (checking anchored) minlen 2 > -e syntax OK > Freeing REx: ".{" > > $ # but > > $ perl -c -Mre=debug -e '/x{/' > Compiling REx "x{" > Unescaped left brace in regex is deprecated, passed through in regex; > marked by <-- HERE in m/x{ <-- HERE / at -e line 1. > Final program: > 1: EXACT <x{> (3) > 3: END (0) > anchored "x{" at 0 (checking anchored isall) minlen 2 > -e syntax OK > Freeing REx: "x{" > I can confirm your observations that no exceptions are thrown in these instances in perl 5.24.0. I can also confirm your observations re "perl -c -Mre=debug -e ...". I am not a regex expert and didn't follow the discussion of this feature. But I suspect this may be a case where the error message is not sufficiently precise as to the error condition. If we look at the source code we see this starting at line 13190 of 'regcomp.c': ##### case '{': /* Currently we don't care if the lbrace is at the start * of a construct. This catches it in the middle of a * literal string, or when it's the first thing after * something like "\b" */ if (len || (p > RExC_start && isALPHA_A(*(p -1)))) { RExC_parse = p + 1; vFAIL("Unescaped left brace in regex is illegal"); } /*FALLTHROUGH*/ default: /* A literal character */ ##### The term 'construct' is used (as both noun and verb) throughout the inline comments in this file but I didn't see a precise definition of its noun version. I'm also not entirely clear as to what 'literal string' and 'something like "\b"' mean. But I would hazard a guess that in the examples you cite, the characters preceding the unescaped left brace, i.e., ##### . [x] [xy] \p{Latin} ##### ... because they are all regex-y things, disqualify these from being 'literal strings' and thus do not qualify as an error conditions. Pinging our regex experts! Thank you very much. -- James E Keenan (jkeenan@cpan.org) --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=128213Thread Previous | Thread Next