in reply to Re: Why doesn't this regex work? ( lookaround backtracking pos)
in thread Why doesn't this regex work? (Solved!)

there is one \s and it is outside of the lookaround ... so its checking every other number

BINGO! Thank you.

If I put the first space into a lookbehind: s[(?<=\s)(\d+)\d\K\s(?=(\d+)\d\s)]{

Or substitute the zero length \b--which will serve the same purpose: s[\b(\d+)\d\K\s(?=(\d+)\d\s)]{

The substitution works as I wanted it to.

But damn I could not see that for looking.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^3: Why doesn't this regex work? ( lookaround dynamic postponed pattern (??{ code })
by Anonymous Monk on Aug 15, 2013 at 12:08 UTC

    Took me a few dozen looks, I started to compose some funny(wrong) answers some 3-4 times

    The experimental (??{ code }) feature looks kinda neat

    perl -le " $_ = shift; s{(\d+)\d\s\K(?=(??{$1+1})\d\s)}{\n}g; print " +"11 12 21 22 32 33 41 44" 11 12 21 22 32 33 41 44
      Took me a few dozen looks, I started to compose some funny(wrong) answers some 3-4 times

      Makes me feel a little better that I'm not the only one had trouble seeing it :)

      The experimental (??{ code }) feature looks kinda neat

      Indeed. Trouble is I can never remember whether it is the (?{}) or (??{}) that interpolates; and rather than go look it up, I opt for an alternative if one springs to mind.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.