in reply to Parse for a list in a long string
Thanks for all the responses and ideas.
I was aware that this was a double loop problem, but I tried it with a single regexp anyway, and crashed against the fact that if I add a quantifier to a grouping, I could get only the last match for that group in the result... I was trying to bypass that!
This line solved my problem in a very simple way:
push @items, $1 =~ /, ?(\w+)/g while /\btest \w+(?:(?: is)? \w+)?((?: ?, ?\w+(?:(?: is)? \w+)?)+)/ig;
|
|---|