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
In reply to Re^5: Regular expressions: Extracting certain text from a line
by kcott
in thread Regular expressions: Extracting certain text from a line
by Wcool
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |