On 02Apr2012 16:16, Gary Johnson <garyj...@spocom.com> wrote: | On 2012-04-02, steve wrote: | > I'm trying to write a regexp in order to capture some words to put them | > in color. I have a line like this in my .muttrc: | > | > color body red default "\<etch\>|((L|l)enny)|((S|s)queeze)|((S|s)arge)|((P|p)otato)" [...] | Take a look at the mutt manual, in the Regular Expression section. | There it says that the beginning and end of a word are matched with | '\\<' and '\\>', respectively. | | Quoting in mutt has always confused me. Try "\\<etch\\>" alone | first. If that doesn't work, try adding backslashes until it does. | Then expand your expression from there.
You need double backslashes because two things are happening. Firstly, the regexp wants \< and \> for word boundary markers because that is needed to make < and > into special markers instead of literal characters. Figure out the regexp "raw" like this first. Thus: \<etch\> Secondly, you're putting that in a quoted string. Single slosh (\) is used in quoted strings to quote stuff (eg \" for a literal double quote), you need to write \\ for a literal slosh. And you want a literal slosh. Thus: "\\<etch\\>" Cheers, -- Cameron Simpson <c...@zip.com.au> DoD#743 http://www.cskk.ezoshosting.com/cs/ No man should escape our universities without knowing how little he knows. - J. Robert Oppenheimer