I am trying to write a flex program that operates on text consisting of all strings of a’s, b’s, and c’s. The string I need to match is of the form abxba, where x does not contain ba as a substring (for example, abccabba, but not abccbaba). This is the lex regular expression I’m trying to use to do this, but it won’t compile:
^[a]{1}[b]{1}[abc|cab|bca|acb|ac|ca|ab|bc|cb][b]{1}[a]{1}$
I’m a bit new to lex/flex, so I apologize if this is very basic. Anyone know what’s wrong?
This will work:
^ab(a|c|b+[c])*b+a$