Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!ll-xn!mit-eddie!uw-beaver!ubc-cs!alberta!edm!rroot From: rroot@edm.UUCP (Stephen Samuel) Newsgroups: comp.unix.wizards Subject: Re: what should egrep '|root' print? (syntax/semantics) Message-ID: <3278@edm.UUCP> Date: 22 Sep 88 23:24:05 GMT References: <857@yunexus.UUCP> Organization: Unexsys Systems Inc., Edmonton,AB. Lines: 30 From article <857@yunexus.UUCP>, by oz@yunexus.UUCP (Ozan Yigit): > [Apologies to those getting tired of this topic.] > In article <8209@alice.UUCP> andrew@alice.UUCP (Andrew Hume) writes: >> >it sounds appealing to allow a missing RE to mean the empty string >> but i am unconvinced as to its utility. > I agree that "blah(foo||bar)gasp" may not look quite as interesting > (arguably) as "blah(foo|bar)+ptui", but if they are equivalent (yeah, > I know, gasp is not equivalent to ptui. :-) and if there is no solid > syntactic reason to allow one and disallow other, then, why bother > to come up with excuses for it ?? I am inclined to say that it might be worthwile to allow it for the purpose of completeness. If you have something that does string replacements, then there IS a real difference between: // , /foo|/ and /foo/ especially if they are prefixed by something else: for example, you might want to do something like: change: /go\(ing|one|\) / = /went/ and if you were using grep to search for things like that, it would be nice to be able to be able to use pieces of your other expressions in a 'grep' search, even if it does look like a null event sometimes. -- ------------- Stephen Samuel Disclaimer: You betcha! {ihnp4,ubc-vision,seismo!mnetor,vax135}!alberta!edm!steve BITNET: USERZXCV@UQV-MTS