Hi Jamie, On Wed, Mar 24, 2010 at 03:22:20PM +0000, Jamie Griffin wrote: > my pattern is trying to match either of two domains in one pattern, the two > domains in question are: > > cs.man.ac.uk and manchester.ac.uk > > So when replying to mail sent to my university cs account, or to other people > at the university, my from header is changedi because i've got all my > university mail being forwarded to my server at home. This is the pattern > i've come up with and which is not working: > > folder-hook . "send-hook '~t "(manchester|cs.man)\.ac\.uk"' 'my_hdr > From: Jamie Griffin <griff...@cs.man.ac.uk> ; \ > my_hdr Reply-To: ja...@fantomatic.co.uk'"
I do not understand why you are running the send-hook inside of the folder-hook. Do you have some other hooks that are removing the effect of the send-hook elsewhere? It would be much simpler to do this: send-hook . unmy_hdr reply-to from send-hook '~t "(manchester|cs.man)\.ac\.uk"' my_hdr From: Jamie Griffin <griff...@cs.man.ac.uk> send-hook '~t "(manchester|cs.man)\.ac\.uk"' my_hdr Reply-To: ja...@fantomatic.co.uk > I read a bit in the manual that said: > > "Note that if a regular expression contains parenthesis, or a veritical bar > ("|"), you must enclose the expression in double or single quotes since those > characters are also used to separate different parts of Mutt's pattern > language. " > > so i've double quoted the bit that contains the parentheses and verticle bar, > but I still keep getting error: > > "parentheses not balanced" > > ... whenever i start up mutt. It must be something really simple i'm missing, > and have misunderstood the information i've read in the manual. Would someone > be able to explain the error i've made to help me understand how ot fix it? The fundamental problem with your original approach is the fact that hooks remove one level of quoting. Here is your orignal: folder-hook . "send-hook '~t "(manchester|cs.man)\.ac\.uk"' 'my_hdr From: Jamie Griffin <griff...@cs.man.ac.uk> ; \ my_hdr Reply-To: ja...@fantomatic.co.uk'" When the folder-hook fires, one level of quotes is removed, leaving: send-hook '~t (manchester|cs.man).ac.uk' 'my_hdr From: Jamie Griffin <griff...@cs.man.ac.uk> ; my_hdr Reply-To: ja...@fantomatic.co.uk' Notice that the quote just before the send-hook matches the double quote just after ~t, which is not what you intended. Now, when the pattern in the send-hook is parsed, it sees two pieces: ~t (manchester | cs.man).ac.uk Which is just what the manual was warning about with the OR (|) operator. me
pgp3MKUG7ouSH.pgp
Description: PGP signature