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?