in reply to Regex: Embedded pattern-match modifiers: Empty (?) modifier

Hello AnomalousMonk,

The output can’t be exactly the same across versions 5.8 to 5.14, because in 5.14.0 the (?^...) construct was added to signify default modifiers (see perl5140delta#Regular-Expressions). So, from 5.14 on, the output is:

14:13 >perl 1868_SoPW.pl (?^:(?).*u\/ba$) A: match (?^msx: \A foo (?^:(?).*u\/ba$) ) B: match 14:13 >

But with that caveat, the behaviour is identical across my Strawberry Perl versions 5.12.3, 5.14.4, 5.18.2, 5.20.2, 5.22.0, 5.24.1, and 5.26.0.

My guess — and it’s no more than a guess — is that the documentation is wrong, and should read: Zero or more embedded pattern-match modifiers ...

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Regex: Embedded pattern-match modifiers: Empty (?) modifier
by shmem (Chancellor) on Feb 10, 2018 at 14:21 UTC
    My guess — and it’s no more than a guess — is that the documentation is wrong, and should read: Zero or more embedded pattern-match modifiers ...

    Even if it is only a guess that the documentation is wrong: if it is underpinned by valid test cases, this warrants a bug report, so this can be evaluated and eventually be fixed.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
      Reported. Watch the thread for updates, currently it isn't clear whether the code will be fixed, or the docs.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        Perl 5.30 will change the documentation to Zero, and this will remain legal to accommodate machine generated code. A warning will be issued if the pattern is compiled within the scope of a "use re 'strict'" pragma. This will accommodate people who want to catch no-ops that are possibly typos.