Reputation: 29316
I want to find all occurrences of the ">" character that are not at the beginning of the line.
For example:
This is a <em>test</em>, this is not a drill.
> Shouldn't
The first two ">" should be caught, but the last shouldn't, as it starts a line.
I tried: (?<!$)>
to no avail.
Upvotes: 1
Views: 48
Reputation: 107287
Use a negative look-behind :
/(?<!^)>/gm
Demo https://regex101.com/r/wW2hO3/1
Note that you need use multi-line flag (m
) which makes the regex engine match the anchors for each line, instead of whole of string.
Upvotes: 3