Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!ll-xn!mit-eddie!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.unix.wizards Subject: Re: what should egrep '|root' print? (syntax/semantics) Message-ID: <454@quintus.UUCP> Date: 21 Sep 88 03:24:08 GMT References: <44414@beno.seismo.CSS.GOV> <68203@sun.uucp> <8202@alice.UUCP> <410@quintus.UUCP> <8209@alice.UUCP> <857@yunexus.UUCP> <1988Sep20.043728.20198@utzoo.uucp> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 22 In article <1988Sep20.043728.20198@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >Well, personally, I'd dearly love to be able to use (| and |) as metasymbols, Why not use (* ... ) as the meta-construct? >(2) programs that generate regexps might have to go out of their way to >avoid generating these magic sequences. Argh. Any thoughts? I suggest that there ought to be a way for programs to generate R.E.s *without* using magic sequences. How about having a program do e.g. begin_re(); /* "/" */ literal("foo"); /* "foo" */ begin_alternatives(); /* "(" */ literal("baz"); /* "baz" */ next_alternative(); /* "|" */ end_alternatives(); /* ")" */ literal(".c"); /* "\.c" */ pattern = end_re(); /* "/" */ to obtain a pattern equivalent to Csh's foo{baz,}.c It is *already* the case that programs which generate patterns have to go out of their way to avoid far too many magic sequences; a library like this would eliminate the problem at the source.