[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regex in sift statements



> String-sift sounds like Bourne shell's "case", so why not call it that.

	It does, at the first hearing...

	With a SIFT you can do things like following from  rrouter.cf:
----------------------------------------------------------------
	sift "$address" in
	# first make canonical
	(.*)<(.*)
		address="\1\2\3" ;;		# defocus
	(.*)>(.*)
		address="\1\2\3" ;;		# defocus
	.*
		address=$(canonicalize "$address") ;;
	<in%>(.*)
		return (((error vms-in-pros "in%\1" $A))) ;;
----------------------------------------------------------------

	... and following happens ...
----------------------------------------------------------------
z# trace compare
z# rrouter "mea<@foo>" mea@foo G0
        comparing ^(.*)<(.*)$ and 'mea<@foo>'
        comparing ^(.*)>(.*)$ and 'mea@foo>'
        comparing ^.*$ and 'mea@foo'
            comparing ^<>$ and 'mea@foo'
	........
                comparing ^(.*)<@(.)>(.*)$ and 'mea<@foo>'
        comparing ^<in%>(.*)$ and 'mea<@foo>'
----------------------------------------------------------------


With  case  you match one, and "bam!" -- out you go.


Is it now clearing up ?

	/Matti Aarnio	<mea@nic.funet.fi>