Given a regular expression R that describes a regular language (no fancy backreferences). Is there an algorithmic way to construct a regular expression R* that describes the language of all words except those described by R? It should be possible as Wikipedia says:
The regular languages are closed under the various operations, that is, if the languages K and L are regular, so is the result of the following operations: […] the complement ¬L
For example, given the alphabet {a,b,c}, the inverse of the language (abc*)+ is (a|(ac|b|c).*)?
As DPenner has already pointed out in the comments, the inverse of a regular expresion can be exponentially larger than the original expression. This makes inversing regular expressions unsuitable to implement negative partial expression syntax for searching purposes. Is there an algorithm that preserves the O(n*m) runtime characteristic (where n is the size of the regex and m is the length of the input) of regular expression matching and allows for negated subexpressions?
checking whether there is a match, then logically negate the result
(has match --> false, no match --> true). – Eyelet(1)
Complement of Regular Language(RE) is regular(2)
to find RE of complement language. do likeRE-->NFA-->DFA-->minimized DFA --> COMPLEMENT DFA --> RE
. (a)RE-->NFA
is algorithmic LEX parser (b)NFA --> DFA
is algorithm (c)DFA --> MINIMIZED DFA
again algorithmic (bothb
andc
school time assignments) (d)DFA --> COMPLEMENT DFA
is algorithmic (by reading my answer I lined you can realized) (e) complementDFA-->RE
is algorithm using ARDEN'S THEOREM. So What I mean to say for a given RE you can find RE for complement. – Antepast