in reply to Re: How to capture backwards using regex?
in thread How to capture backwards using regex?

> passes all of LanX's tests and doesn't need 5.38

Are you implying that 5.38 is needed for my code?

I didn't bother to check version dependencies...

Anyway I could think of other workarounds but the pos and \G solution is hard to beat.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

  • Comment on Re^2: How to capture backwards using regex?

Replies are listed 'Best First'.
Re^3: How to capture backwards using regex?
by choroba (Cardinal) on Nov 11, 2024 at 19:53 UTC
    > Are you implying that 5.38 is needed for my code?

    No, sorry, I misread what you wrote:

    > Unfortunately with variable length this still seems experimental with 5.38 ...

    In fact, 5.30 is enough to run it, see perlre:

    Prior to Perl 5.30, it worked only for fixed-width lookbehind, but starting in that release, it can handle variable lengths from 1 to 255 characters as an experimental feature.

    The (*pla:pattern) syntax is from 5.28, in earlier versions, the only possible syntax was (?<=).

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      > (*pla:pattern) syntax is from 5.28

      Yes I was aware about this being "new", but honestly I really have problems remembering the old syntax.

      > Prior to Perl 5.30, it worked only for fixed-width lookbehind

      I think a more interesting task would be to show applications of *plb or *nlb which can't be emulated with \G

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery