From: Dan Doel [mailto:dolio@case.edu]
1) Convert the regex to a DFA
2) Invert the accept states of the DFA, causing it to accept the
complement
of the initial language
3) Convert the modified DFA into a regex
Good point! I assume steps 1 and 2 are left as exercises for the reader
:-).
However, it should be noted that regular expressions aren't really
regular
these days. For example, Ruby allows the following regex:
/(a*)b(\1)/
Which accepts the language { (a^n)b(a^n) }, which is context free, not
regular (that is, it cannot be encoded as the language of a finite
automaton---it requires something like a pushdown automaton (FA with a
stack)---or the language of a true regular expression---it requires a
context free grammar). So, if you want to invert an arbitrary
Ruby/Perl/Python "regular expression," you've got a tougher time on
your
hands.
Another good point. Yes, REs as used in computer languages have
certainly moved on.
Thanks for the insight.
H.
···
************************************************************************
If you have received this e-mail in error, please delete it and notify the sender as soon as possible. The contents of this e-mail may be confidential and the unauthorized use, copying, or dissemination of it and any attachments to it, is prohibited.
Internet communications are not secure and Hyperion does not, therefore, accept legal responsibility for the contents of this message nor for any damage caused by viruses. The views expressed here do not necessarily represent those of Hyperion.
For more information about Hyperion, please visit our Web site at www.hyperion.com