M
mrclean_ii
Let me explain: If I have a text like
"...target1.....target2...target2..." the pattern
"target1[\s\S]*target2" will match from "target1" to the LAST
"target2". If we slightly change the pattern to
"target1[\s\S]*?target2" the expression becomes non-greedy and the
pattern will match from "target1" to the FIRST "target2".
Now suppose the text is "...target1.....target1...target2..." and I
want to match from the LAST "target1" to the "target2" (what I would
call "non-greedy backwards"). Any help would be appreciated, thank you!
"...target1.....target2...target2..." the pattern
"target1[\s\S]*target2" will match from "target1" to the LAST
"target2". If we slightly change the pattern to
"target1[\s\S]*?target2" the expression becomes non-greedy and the
pattern will match from "target1" to the FIRST "target2".
Now suppose the text is "...target1.....target1...target2..." and I
want to match from the LAST "target1" to the "target2" (what I would
call "non-greedy backwards"). Any help would be appreciated, thank you!