[mew-int 2931] Re: Identify urls

Christophe TROESTLER <[email protected]> Fri, 05 Nov 2010 10:29:44 +0100 (CET)
Newsgroups gmane.mail.mew.general
Organization Universite de Mons (http://math.umons.ac.be/an/)
Message-ID <20101105.102944.286585907249084437.Christophe.Troestler@umons.ac.be>
On Fri, 5 Nov 2010 00:22:55 -0200, Diogo F. S. Ramos wrote:
> 
> Sometimes Mew can't identify correctly an url. Looking at this issue,
> it does not seem trivial to identify one using regex. Heck, even
> `thingatpt' can't always do it as one would expect (try
> `(http://www.example.com)').
> 
> Well, I slightly modified the regex used by Mew to identify urls. In
> my brief experience it seems to recognize correctly a little bigger
> set of urls than the previous one.

I am not sure allowing closing braces inside URLs is the way to go.
Sure some URLs contain braces but these are usually balanced.  I
personally use the following regex to allow "depth 1" matching braces.

(setq mew-regex-url
  (let ((u "[^  	\n>()\"]*"))
    (concat "\\b\\(\\(\\(file\\|news\\|mailto\\):\\)"
	    "\\|\\(\\(s?https?\\|ftp\\|gopher\\|telnet\\|wais\\)://\\)\\)"
	    "\\(" u "\\|(" u ")\\)*[^  	\n>.,:)\"]+")))

My 0.02€,
C.