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

Re: highlighting urls ???



Gary Johnson <garyjohn@xxxxxxxxxxxxxxx> [2004:01:10:10:32:30-0800] scribed:
> On 2004-01-10, Michael D Schleif <mds@xxxxxxxxxxx> wrote:
> > OK, I have this URL:
> > 
> >    http://support.microsoft.com/default.aspx?scid=kb;[LN];Q260371
> > 
> > I have been using this in ~/.muttrc:
> > 
> >    color body brightblue default 
> > (https?|ftp)://[\-\.\,=/%~_:?\#a-zA-Z0-9&+]+
> > 
> > I am having problems adding the square brackets `[]' to that regexp.
> > 
> > Interestingly enough, the following only highlights `N]' and *not* `[L':
> > 
> >    color body brightred default [a-zA-Z0-9\[\]]+
> > 
> > Other attempts to escape `\[' and `\]' result in errors at mutt startup,
> > and *NO* highlighting at all.
> > 
> > What do you think?
> 
> >From the mutt manual, under "Regular Expressions":
> 
>   A list of characters enclosed by ``['' and ``]'' matches any single
>   character in that list; if the first character of the list is a caret
>   ``^'' then it matches any character not in the list.  For example, the
>   regular expression [0123456789] matches any single digit.  A range of
>   ASCII characters may be specified by giving the first and last
>   characters, separated by a hyphen ``-''.  Most metacharacters lose
>   their special meaning inside lists.  To include a literal ``]'' place
>   it first in the list.  Similarly, to include a literal ``^'' place it
>   anywhere but first.  Finally, to include a literal hyphen ``-'' place
>   it last.
> 
> 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?

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--

Attachment: pgpQnkCsGxrlf.pgp
Description: PGP signature