Actually that can be done in O(n lg n) using Hopcroft's Algorithm, but it's not a well known or particularly easy algorithm. See Hopcroft's 1971 paper, though even the academics find it a bit dense, which led Gries to write a paper called Describing an algorithm by Hopcroft a year later. Unfortunately the latter is not freely available online.
All this is surely overboard for the poster's original question, I just wanted to share this tidbit since it's not easy to come by.
In reply to Re^4: Compare two regex patterns
by Anonymous Monk
in thread Compare two regex patterns
by atemon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |