Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uxc!tank!oddjob!matt From: matt@oddjob.uchicago.edu (Matt Crawford) Newsgroups: comp.mail.sendmail Subject: Re: Simple Ruleset Sought Message-ID: <3131@tank.uchicago.edu> Date: 9 May 89 16:08:07 GMT References: <8130@pyr.gatech.EDU> <11154@polyslo.CalPoly.EDU> Sender: news@tank.uchicago.edu Reply-To: matt@oddjob.uchicago.edu (Matt Crawford) Distribution: usa Organization: Department of Entropy Lines: 29 >if I had a ruleset that would convert A!B!C@D to A!B!D!C >I think things would work better. Without judging whether this is the right thing to do, here is a sequence of rules to make that transformation. I assume there may be more than two !s in the input, and also that there are no bracketing angle brackets present when these rules are invoked. Oh, and I also assume that any of A, B, ... may consist of multiple "words". R$+!$+@$+ $:$1!<$2@$3> focus on at-sign R$+<$+!$+@$+> $1$2!<$3@$4> get all bangs outside R$+<$+@$+> $1$3!$2 convert at-sign to bang Exercises for those still learning the cf language: 1. Why is the second rule needed? 2. Why is the "$:" needed in the first rule? Why not in the third? In case, as Steve DeJarnett suggested, you really want to turn A!B!C@D into D!A!B!C (although RFC822 has little or nothing to do with this), a single rule suffices. R$+!$+@$+ $3!$1!$2 final at-sign to initial bang Any of these rules could have undesired effects when the input is not of the assumed form ... for instance, if there are multiple @s. ________________________________________________________ Matt Crawford matt@oddjob.uchicago.edu