0

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?

dovid
  • 6,354
  • 3
  • 33
  • 73

1 Answers1

2

Use a negative look-behind: ?<!

/(?<!a)[1-9]/

https://regex101.com/r/E7k5t4/1

Joseph Marikle
  • 76,418
  • 17
  • 112
  • 129