Reputation: 6491
the texts:
1a2c3
i want all number which does not have a
berfore it: 1, 3
I thought it was a classic case of negative lookahead:
(?!a)[1-9]
but the result is: 1,2,3
What is my mistake? And what way do I need to find only those who have no match whatsoever?
Upvotes: 0
Views: 41
Reputation: 78590
Use a negative look-behind: ?<!
/(?<!a)[1-9]/
https://regex101.com/r/E7k5t4/1
Upvotes: 2