<<< Date Index >>>     <<< Thread Index >>>

Re: matching square brackets in hooks



[=- Nicolas Rachinsky wrote on Thu 10.Nov'05 at  1:34:55 +0100 -=]

> * Volker Kuhlmann <list0570@xxxxxxxxxxxxxxx> [2005-11-10 13:01 +1300]:
> >   fcc-save-hook "~s '[aaa-bbb]'" =box
> >   fcc-save-hook '~s "\[aaa-bbb\]"' =box
> > { fails to quote [] }
> 
> The backslashes are removed before the regex engine gets the
> string. You have to escape them often enough, but I'm too tired
> to calculate the correct number. The easy way would be to just
> try it.
> I think doubling or trippling them should help.
> {...}
> > {...} As the regex engine is clearly stated as POSIX or gnu
> > awk, I expect a \[ to mean a literal bracket.
> 
> Yeah, that works, but you have to pass \[ to the regex engine.

Nicolas is correct with all he wrote.
Maybe http://wiki.mutt.org/?PatternQuoting gives you a better idea
of how and why.
Feel free to correct/ expand as necessary.

> > This appears to be not so, as 
> >   fcc-save-hook "~s '[[]aaa-bbb[]]'" =box
> > actually works.
> 
> Why not just use that?

Because it looks ugly and is confusing. :)

Note, the [] have no special meaning on every level where quoting
is needed, see the above URL.

-- 
© Rado S. -- You must provide YOUR effort for your goal!
Even if it seems insignificant, in fact EVERY effort counts
for a shared task, at least to show your deserving attitude.