gruber

Gruber’s URL Regular Expression in Python

How do I rewrite this new way to recognise addresses to work in Python? \b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))) ...

Url Matching using Gruber's regex in PHP

how do I get the regex mentioned in this article working with preg_match in php? <?php preg_match("\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))/i", $text, $matches); print_r($matches); ?> Using the code above I get the following error: Warning: preg_match() [function.preg-match]: Delimiter must not be alphanume...

Help Hacking Gruber's Liberal URL Regex

I've taken the Liberal URL Regex from Daring Fireball, merged it with some of Alan Storm improvements and hacked my way into fixing some bugs like support for IDN chars inside parentheses. This is what I've: /(?:[\w-]+:\/\/?|www[.])[^\s()<>]+(?:(?:\([^\s()<>]*\)[^\s()<>]*)+|[^[:punct:]\s]|\/)/ However I've encountered a bug that I'm n...

How do I fix "invalid group" error when attempting to use Gruber's "improved" URL matching regexp pattern in JavaScript?

I'm attempting to integrate John Gruber's An Improved Liberal, Accurate Regex Pattern for Matching URLs into one of my Javascripts, but WebKit's inspector (in Google Chrome 5.0.375.125 for Mac) gives an "Invalid group" regular expression syntax error. Gruber's original regexp is as follows: (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|ww...