Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox From: bfox@AUREL.CALTECH.EDU (Brian Fox) Newsgroups: gnu.bash.bug Subject: regular expressions Message-ID: <8908292100.AA00161@aurel.caltech.edu> Date: 29 Aug 89 21:00:21 GMT References: <3073@solo4.cs.vu.nl> Sender: daemon@tut.cis.ohio-state.edu Reply-To: bfox@aurel.caltech.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 34 Date: 25 Aug 89 16:12:23 GMT From: maart@star.cs.vu.nl (Maarten Litmaath) Organization: V.U. Informatica, Amsterdam, the Netherlands Sender: bug-bash-request@prep.ai.mit.edu I've always wanted to be able to do something like the following: case $domain in \(.*\)\.\(.*\)\.edu) department=\1 university=\2 *) # ... esac instead of case $domain in *.*.edu) department=`echo "$domain" | sed 's/\([^.]*\).*/\1/'` university=`echo "$domain" | sed 's/.*\([^.]*\).edu/\1/'` *) # ... esac You get the idea. Is this possible with bash? Well, not without changing the semantics of the "case" command, and writing a regular expression parser into the shell. The pattern matcher is a globber, not a RE parser. Sorry. Brian