negating words with Java regular expressions

Raj.Ashar@jhuapl.edu (Raj Ashar)
13 Jul 2004 12:09:32 -0400

          From comp.compilers

Related articles
negating words with Java regular expressions Raj.Ashar@jhuapl.edu (2004-07-13)
Re: negating words with Java regular expressions amit_shanbhag@yahoo.com (=?iso-8859-1?q?Amit=20Shanbhag?=) (2004-07-13)
| List of all articles for this month |

From: Raj.Ashar@jhuapl.edu (Raj Ashar)
Newsgroups: comp.compilers
Date: 13 Jul 2004 12:09:32 -0400
Organization: http://groups.google.com
Keywords: lex, question
Posted-Date: 13 Jul 2004 12:09:32 EDT

All, is there a way to negate words using regular expressions as
implemented by Java? I know that one can negate the characters in a
character class using the caret ([^a-z]), but I would like to build
expressions of the form:


Match ";" and not "5;".


Though one can match strings positively (as in match against string
"abc"), there does not appear to be a simple way to indicate negative
matches (do not match "abcd").


Thank you.


Raj


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.