On Sep 2, 2010, at 12:54, John Musbach <[email protected]> wrote:
> Very neat trick, looking at your fortune file, what does the following
> line do? Grab text from a web resource?
>
> (?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
This is John Gruber's regex for matching URLs.
It's nice in that it works in almost all cases without getting all bogged down
into too many edge cases.
That is to say, it's not 'perfect' but it's perfect enough.
_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk