[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On refining regexp by adding exceptions systematically
From: |
gnuist |
Subject: |
On refining regexp by adding exceptions systematically |
Date: |
3 Oct 2002 05:27:55 -0700 |
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.
I am using this regexp in two ways in a different program.
In the first one (looking-at regexp) so that it assumes that
cursor is on it. In the second one (search-forward-regexp regexp)
in a narrowed region so that one is trying to find if there is one.
It seems to me that it is a little tricky to do this. Perhaps an
example code would help with exception implemented for searching
on a line.
Thanks a lot!
gnuist007