[Top][All Lists]

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

Re: On refining regexp by adding exceptions systematically

From: Stefan Monnier <address@hidden>
Subject: Re: On refining regexp by adding exceptions systematically
Date: 05 Oct 2002 12:11:30 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>> Here is regular expression in emacs lisp that initially seems to work
>> for the job:
>> [A-Z][A-Z][A-Z][0-9]+
>> After running it on a number of uses, I find that there is an exception
>> to it, namely PJP89898.   Rather than rehashing the code after having
>> forgotten it and reworking my regexp expression (every time I find an
>> exception) in some convoluted way, is there a systematic way to add an
>> exception or a series of exceptions to the regexp? I am sure that there
>> are a number of ways to do this and each has its merits.
> Regular expressions are designed to find string expressions which are,
> well, regular.  If you really want to add in an exception like you've
> got, you're going to end up with something horrible.  It can be done, but
> like rowing the Atlantic, why bother?

Actually, the end would still be regular.  But it's not currently supported
by Emacs' regexp engine.
Oh and BTW, extended regular expressions (as seen in Emacs and egrep)
are actually not regular because of back-references.
Perl regexps have support for things like that.


reply via email to

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