help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?


From: Yuri Khan
Subject: Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?
Date: Sun, 12 Nov 2023 15:28:21 +0700

On Sun, 12 Nov 2023 at 14:27, <tomas@tuxteam.de> wrote:

> Actually... the complement of a regular language is also a regular
> language, so there should be a regexp for that, too.

In all(?) the courses that taught me the theory of regular languages,
the construction of a negation of a regexp would be suitable as the
practical part of an exam question sheet.

As the first step, it is relatively straightforward to build a
non-deterministic finite state machine from the original regexp; then
we complement that NDFA’s set of accepting states; and then it’s a
tedious, error-prone job of building a regexp equivalent to that
complemented NDFA.

The regexp thus obtained is often not a pretty sight, either.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]