🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #613

Re: regular expressions

#613
From: Bennett Todd
Date: Mon, 18 Sep 1989 21:27
21 lines
1007 bytes
>   case $domain in
>   \(.*\)\.\(.*\)\.edu)
>	   department=\1
>	   university=\2
>   *)
>	   # ...
>   esac

Hmm. I don't mind the current notion of "case" using globbing rather
than r.e. matching. expr(1) makes r.e. substitution available easily
enough. I'd rather see expr(1) built in for performance reasons (like
echo, test, etc.) than see the definition of the case construct changed,
or see another extended case construct added.

By the way, I would code the above example:

	department=`expr $domain : '\([^.]*\)\..*$'`
	university=`expr $domain : '[^.]*\.\([^.]*\)\..*$'

-Bennett
bet@orion.mc.duke.edu
Technical Details
Message-ID: <8909182127.AA08977@orion>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ORION.MC.DUKE.EDU!bet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ORION.MC.DUKE.EDU!bet
From: bet@ORION.MC.DUKE.EDU (Bennett Todd)
Newsgroups: gnu.bash.bug
Subject: Re: regular expressions
Message-ID: <8909182127.AA08977@orion>
Date: 18 Sep 89 21:27:40 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 21