0

I want to write a regular expression for a pattern b not preceded by an odd number of repetitions of the letter a using Python's re module. In principle,

(?<=(?<!a)(aa)*)b

would do what I want, but this isn't legal because lookbehinds need to have a fixed length.

How can I do this?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
schtandard
  • 387
  • 4
  • 18

0 Answers0