Reputation: 2790
I have this string:
"<myTag att1="val1"><myTag></myTag></myTag><myTag></myTag>"
What I need is to match:
<myTag att1="val1"><myTag></myTag></myTag>
I tried with a regex but it gets:
<myTag att1="val1"><myTag></myTag>
How can I resolve?
Upvotes: 1
Views: 904
Reputation: 96
Eliminate the default greedy nature and write something below:-
(.+?)
Please note, att1="val1" might not recognize in the string in few editors. Hence for that prefix a '\'. But the above regex should work
Upvotes: 1