in reply to Regex help
The problem with your version was that the + in the second container was just +ing the B, so you need to group around the string "AB". But then you get only 1 AB!my ($start,$middle,$end) = $string =~ /^(.*?)((?:$pattern)+)(.*?)$/g;
Since you want to have all AB's, you need to capture that whole thing again. So there are grouping parentheses around that again. And to not change the order of the captured strings, the inner one has ?: which indicates that it's just a grouping and not a capture.
Hope this helps.
Liz
|
|---|