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

Stephen Samuel rroot at edm.UUCP
Fri Sep 23 09:24:05 AEST 1988


>From article <857 at yunexus.UUCP>, by oz at yunexus.UUCP (Ozan Yigit):
> [Apologies to those getting tired of this topic.]
 
> In article <8209 at alice.UUCP> andrew at 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 at UQV-MTS



More information about the Comp.unix.wizards mailing list