[mew-int 2931] Re: Identify urls

Christophe TROESTLER Christophe.Troestler at example.com
Fri Nov 5 18:29:44 JST 2010


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.


More information about the Mew-int mailing list