Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!iuvax!pur-ee!a.cs.uiuc.edu!m.cs.uiuc.edu!liberte From: liberte@m.cs.uiuc.edu Newsgroups: comp.editors Subject: Re: pattern matches Message-ID: <37200010@m.cs.uiuc.edu> Date: 5 Jul 88 21:04:00 GMT References: <427@grand.UUCP> Lines: 24 Nf-ID: #R:grand.UUCP:427:m.cs.uiuc.edu:37200010:000:1042 Nf-From: m.cs.uiuc.edu!liberte Jul 5 16:04:00 1988 Since I didnt specify what is matched by the negation of a regular expression, I then got trapped by my own lack of clarity. (def)^ is *not* the same as [^def] for two reasons. Thinking they are the same was a dumb mistake. It seems the most reasonable match for the negation of a regular expression is nothing. To match something, you must use a positive regexp concatenated to the negation. Therefore, if you want to match "abc....ghi" but not "abcd..eghi" you could use "abc(d.*e)^.*ghi". So the interpretation is "the negation of a regular expression fails if the regular expression is found and is successful if the regular expression is not found; nothing is matched in either case." Any other interpretation seems to have difficulties, as Stu Friedberg outlined. Consider the negation of a regular expression that contains alternatives. Which of the alternatives should be "matched" if they all must fail in order for the pattern to succeed? Dan LaLiberte uiucdcs!liberte liberte@cs.uiuc.edu liberte%a.cs.uiuc.edu@uiucvmd.bitnet