Hi I am using notepad and I need a regex witch match number 1 not number 2
number 1 <aaaaaa.
number 2 <aaaaaa.>
I tried this but it matches both of them not just number 1
I tried <.*(?!.*\>)
and im expect to be match just number 1 not number 2
CodePudding user response:
You could match only number 1:
^[^<\n>]*<[^\n<>]*$
Explanation
^Start of string[^<\n>]*Match optional chars other than a newline or<or><[^\n<>]*Match<followed by 0 occurrences of any char other than a newline or<or>$End of string
Or if you only want to match the single part:
<(?![^<>\n]*>).*
Explanation
<Match literally(?![^<>\n]*>)Negative lookahead, assert no more occurrence of>to the right.*Match the rest of the line
