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

Re: highlighting urls ???



On 2004-01-10, Michael D Schleif <mds@xxxxxxxxxxx> wrote:
> Gary Johnson <garyjohn@xxxxxxxxxxxxxxx> [2004:01:10:10:32:30-0800] scribed:

> > So for your simple example, I think this will work:
> > 
> >   color body brightred default [][a-zA-Z0-9]+
> 
> OK, bizarre as it is, that color command works.
> 
> However, the following:
> 
>    color body brightblue default 
> (https?|ftp)://[][\-\.\,\;=/%~_:?\#a-zA-Z0-9&+]+
> 
> produces the following mutt startup error:
> 
>    Error in /home/mds/.muttrc, line 500: Invalid range end
>    source: errors in /home/mds/.muttrc
> 
> And, the following:
> 
>    color body brightblue default 
> (https?|ftp)://[][\.\,\;=/%~_:?\#a-zA-Z0-9&+-]+
> 
> produces the following mutt startup error:
> 
>    Error in /home/mds/.muttrc, line 500: Unmatched [ or [^
>    source: errors in /home/mds/.muttrc
> 
> What am I missing?

I don't know for sure.  To be honest, getting any mutt regular
expression to work is often a matter of trial and error for me.  I
usually surround them with single quotes, though, and doing so has
solved a lot of problems for me before.  I just tried executing your
second example,

    color body brightblue default 
(https?|ftp)://[][\.\,\;=/%~_:?\#a-zA-Z0-9&+-]+

at the command line and did get an error.  Then I edited it to add
the single quotes,

    color body brightblue default 
'(https?|ftp)://[][\.\,\;=/%~_:?\#a-zA-Z0-9&+-]+'

and mutt accepted it.  Further, the URLs in the one message I opened
appeared to be colored correctly.

My 5-seconds-of-thought guess is that without the quotes, the ';'
was interpreted by mutt as the end of the color command.

HTH,
Gary

-- 
Gary Johnson                               | Agilent Technologies
garyjohn@xxxxxxxxxxxxxxx                   | Wireless Division
http://www.spocom.com/users/gjohnson/mutt/ | Spokane, Washington, USA