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

matching square brackets in hooks



I'm having serious trouble matching square brackets in regexes used in
hooks. What should have been a simple

  fcc-save-hook "~s '[aaa-bbb]'" =box

(strings inside single-quotes are taken as literal, manual 3.1)

or

  fcc-save-hook '~s "\[aaa-bbb\]"' =box

doesn't work. The fact that error messages consist only of a teminal
"bing" and nothing visible sure doesn't help, but tracing the problem to
the last change isn't too difficult.

However, no mention is made of escaping special regex characters to have
their meanings reverted to literal is made in manual section 4.1. As the
regex engine is clearly stated as POSIX or gnu awk, I expect a \[ to
mean a literal bracket.

This appears to be not so, as 

  fcc-save-hook "~s '[[]aaa-bbb[]]'" =box

actually works.

This sucks for two reasons:

1) In any software I expect POSIX regexes. Nobody has time for
exceptions. That the mutt regexes are POSIX (manual 4.1 first paragraph)
should be all I need to know.

2) The behaviour of mutt which seemingly differs from the manual needs
to be documented clearly. The manual needs to be corrected to describe
actual mutt behaviour, and this should be illustrated with an example as
it's very unexpected behaviour.

Thanks for a good tool,

Volker

-- 
Volker Kuhlmann                 is possibly list0570 with the domain in header
http://volker.dnsalias.net/             Please do not CC list postings to me.