what should egrep '|root' print? (syntax/semantics)

Richard A. O'Keefe ok at quintus.uucp
Wed Sep 21 13:24:08 AEST 1988


In article <1988Sep20.043728.20198 at utzoo.uucp> henry at 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.



More information about the Comp.unix.wizards mailing list