in reply to Re^4: Regular expressions: Extracting certain text from a line
in thread Regular expressions: Extracting certain text from a line

Thanks. This is of interest.

I was aiming for a 5.8 solution: it was only after posting that I noticed ++ wasn't introduced until 5.10.0. Both the 5.8.8 and 5.18.2 doco show the same (??{ code }) example for matching (...), which I more or less copied for {...} and [...], so I wasn't too concerned about the experimental warnings for that bit.

I noticed that SimonPratt had hinted at a (?PARNO) solution (in Re^3: Regular expressions: Extracting certain text from a line) and I did look into that yesterday; although, I didn't spend a huge amount of time on it. Like you, I'm not really across (DEFINE): I'll spend a bit more time looking at this in concert with your code.

I ran the four tests under 5.18.1. The two you'd marked as # works passed all tests for me; the other two (# no) both failed tests 2, 4, 6, 8 and 10 with $got->[0] = Does not exist in every case.

-- Ken

Replies are listed 'Best First'.
Re^6: Regular expressions: Extracting certain text from a line
by AnomalousMonk (Archbishop) on Apr 09, 2014 at 07:44 UTC
    ... the ... doco show the same  (??{ code }) example for matching  (...) ... a  (?PARNO) solution ...

    I'm interested in  (?PARNO) and  (?R) because the documentation examples for nested expressions are almost the same. (Indeed, the doc sez "Similar to "(??{ code })"..." re: (?PARNO).) The impression the docs give is that something like  (?R) is somehow 'safer'. This may be tied up with the fact that  (??{ code }) used to be broken for use with lexicals – a problem I believe was fixed somewhere around 5.16 or 5.18 (I only go as high as 5.14 right now).

    Thanks to the 5.18 feedback on  (DEFINE). Yes, some variations work, some don't, and I don't understand the reason(s) for the differences.