Article View: comp.editors
Article #3221Re: pattern matches
From: Peter da Silva
Date: Sun, 24 Jul 1988 02:27
Date: Sun, 24 Jul 1988 02:27
27 lines
1752 bytes
1752 bytes
In article <37200011@m.cs.uiuc.edu>, liberte@m.cs.uiuc.edu writes: > The only clear definition I could come up for a complement operator is > as follows: if foo describes some regular set (of strings) R, then > !(foo) describes the complement set ~R (with respect to the universe of > all strings). This is well-defined, since the set of regular sets is > closed under union, intersection, and complement. This doesn't seem intuitive to me. More useful would be the set of strings not containing R. I can't see any case why using your definition of ! you would ever use anything but "!(.*foo.*)". This could also be implemented by trying to match "A!BC" first to "A(.*)C", then checking that the intervening stuff didn't match ".*B.*". Of course, this (a) probably doesn't help you build a DFA and (b) could equally well be used for your setup. > This definition is unlikely to do what people would (naively) expect in > the simple cases, because of the typical semantics of "find the first > and longest match, considering all possible substrings of the text." Right, it fails the principle of least astonishment. Are there any general purpose tools that allow you to match more than a single line? -- Peter da Silva `-_-' peter@sugar.uu.net Have you hugged U your wolf today?
Technical Details
Message-ID:
<2333@sugar.uu.net>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!whuts!mhuxh!mhuxu!mhuxt!mhuxi!mhuhk!mhuxo!ulysses!thumper!faline!bellcore!tness7!tness1!nuchat!sugar!peterReferences:
<19413@cornell.UUCP> <37200011@m.cs.uiuc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!whuts!mhuxh!mhuxu!mhuxt!mhuxi!mhuhk!mhuxo!ulysses!thumper!faline!bellcore!tness7!tness1!nuchat!sugar!peter From: peter@sugar.uu.net (Peter da Silva) Newsgroups: comp.editors Subject: Re: pattern matches Message-ID: <2333@sugar.uu.net> Date: 24 Jul 88 02:27:08 GMT References: <19413@cornell.UUCP> <37200011@m.cs.uiuc.edu> Organization: Sugar Land Unix - Houston, TX Lines: 27