How to combine regular expressions?
EDIT: This is if for exam preparation. The question is to write a regular expression to find all lines that have an odd number a and an even number b?
i.e. instead of | for OR, I need a mechanism to emulate AND
I have two regular expressions:
1) to find odd number of a's:
^[^a]*a([^a]*a[^a]*a)*[^a]*$
2) to find even number of b's:
^([^b]*b[^b]*b)*[^b]*$
source
share