I need to match an expression in Python with regular expressions that only matches even number of letter occurrences. For example:
AAA # no match AA
Try this regular expression:
^[^A]*((AA)+[^A]*)*$
And if the As don’t need to be consecutive:
A
^[^A]*(A[^A]*A[^A]*)*$