🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #510

regular expressions

#510
From: Maarten Litmaath
Date: Fri, 25 Aug 1989 16:12
24 lines
932 bytes
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?
-- 
"rot H - dD/dt = J, div D = rho, div B = 0, |Maarten Litmaath @ VU Amsterdam:
rot E + dB/dt = 0" and there was 7-UP Light.|maart@cs.vu.nl, mcvax!botter!maart
Technical Details
Message-ID: <3073@solo4.cs.vu.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!mcsun!hp4nl!botter!star.cs.vu.nl!maart

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!mcsun!hp4nl!botter!star.cs.vu.nl!maart
From: maart@cs.vu.nl (Maarten Litmaath)
Newsgroups: gnu.bash.bug
Subject: regular expressions
Message-ID: <3073@solo4.cs.vu.nl>
Date: 25 Aug 89 16:12:23 GMT
Distribution: gnu
Organization: V.U. Informatica, Amsterdam, the Netherlands
Lines: 24