perl - all possible sub strings matching the regex -
i have string
<start><tag1><tag2><tag3><end>
if have regex <.*end>
matches complete string , stops. there way gives matching substrings ike
<end> <tag3><end> <tag2><tag3><end> <tag1><tag2><tag3><end>
yes, must wrap pattern in lookahead (this way obtain overlapped results):
(?=(<.*end>))
the result in capture group 1.
Comments
Post a Comment