Message-ID with "+" in

Nathan Stratton Treadway muttlists at nathanst.com
Mon Oct 1 03:39:53 UTC 2018


On Sun, Sep 30, 2018 at 14:48:55 -0400, Ben Fitzgerald wrote:
> Works okay so far, except when I hit a message with "+" in, for
> example:
> 
> CAJxp15h8mE6UcYStOyUzH_T490X+hOq5dTo+xxVOZC5WSnh94g at mail.gmail.com
> 
> Here when mutt is given:
> 
> / ~i CAJxp15h8mE6UcYStOyUzH_T490X+hOq5dTo+xxVOZC5WSnh94g at mail.gmail.com
> 
> Lookup fails. Simple attempts to work around this such as enclosing the
> Message-ID in single/double quotes, escaping the "+" as below has no effect:
> 
> / ~i "CAJxpU5h8mE6UcYStOyUzH_T490R\+hOp5dTo\+crVOZC5WSnh94g at mail.gmail.com"
> 
> Probably this is fairly simple, but I'm stuck. Would appreciate advice.

The key thing to remember is that the parsing of the string typed into
the search prompt "uses up" one level of escaping (unless the argument
is inside a single-quote string), and the regular expression itself
uses another level.  So, if you are trying to use a backslash to escape
the "+" in the regular expression, you have to make sure a backslash
survives the parsing step and is included in the regex -- or, you can
instead get the "+" to match using a different sort of "escaping"....

So, (assuming I have cut-and-pasted and counted correctly), the
following should all find the message in question:
/ ~i CAJxpU5h8mE6UcYStOyUzH_T490R\\+hOp5dTo\\+crVOZC5WSnh94g at mail.gmail.com
/ ~i "CAJxpU5h8mE6UcYStOyUzH_T490R\\+hOp5dTo\\+crVOZC5WSnh94g at mail.gmail.com"
/ ~i 'CAJxpU5h8mE6UcYStOyUzH_T490R\+hOp5dTo\+crVOZC5WSnh94g at mail.gmail.com'
/ ~i CAJxpU5h8mE6UcYStOyUzH_T490R[+]hOp5dTo[+]crVOZC5WSnh94g at mail.gmail.com
/ ~i CAJxpU5h8mE6UcYStOyUzH_T490R.hOp5dTo.crVOZC5WSnh94g at mail.gmail.com

(Note that of course the final option will match any character in those
specific positions, rather than only matching a "+" character.)

Hope that makes sense.

						Nathan


More information about the Mutt-users mailing list