Regex match being greedy after using non-greedy operator -
i have following text:
<def id="1">[<note>aa2</note>] valer:<ex>asd</ex></def> <def id="2">awes: [<note>ddd1</note>]:<ex>rfwc sdad</ex>[<note>cc#2</note>]:<ex>saq www</ex>[<note>pol1</note>]:<ex>sasd.</ex></def> <def id="3">esd: [<note>aaa</note>]:<ex>qw wq.</ex>[<note>ps0</note>]:<ex>sad sadad.</ex></def> <def id="4" type="l99">[<note>carsf1</note>] asddds:<ex>ass www.</ex></def>
i'm trying match when there's [
after def
tag opened.
i've pattern:
<def\s.*?>\[<note>(.*?)<\/note>\](.*?):<ex>(.*?)<\/ex><\/def>
but matches lines , i'm not sure why.
here's demo
your first .*
should [^>]*
Comments
Post a Comment