On Sun, Oct 16, 2016 at 05:58:27PM +0200, nfb wrote:
> Hi,
> maybe this is a general and basic question about regex, but i also
> tried on regex101.com and it really should work...
> In my body i'd like to color URL indexes in the form [$ANYNUMBER], so
> in my muttrc i set a line like this:
> color body brightmagenta default "\[[0-9]+\]"
> Now, strings like:
> [1]
> [123]
> etc.
> are matched, and this is what i want, but it seems it also matches
> something like:
> 123]
> :123]
> 12:123]
> What am i doning wrong?

It looks to me as if a second round of evaluation is being done.
During the first round the "\"s would be removed leaving "[[0-9]+]".

The second round would pair the first "[" with the first "]", the
one before the "+" and would make your character class be digits
or opening square bracket.  The final square bracket would be literal.

You may have to play with the number of backslashes, probably doubling
them though in some troff documents it was even necessary to tripling
them in order to have one preserved when it was needed.

Jon H. LaBadie                 j...@jgcomp.com
 11226 South Shore Rd.          (703) 787-0688 (H)
 Reston, VA  20190              (703) 935-6720 (C)

Reply via email to