Twitter    Archive    Xbox Live    Site Contents    Tumblr Faves    Stars

  Send me a message.    Ask me a question.  

A few modest contributions to the blogosphere from Andy Fluke,
co-founder of the National Coalition
for Dialogue & Deliberation.

Sat Nov 28

Regex URL Hunting

This is very geeky — very, very geeky.  John Gruber offers this regex (search) pattern identifying URLs in a page or selection of text.

\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))

I have a love / hate relationship with regex.  Its power to create shortcuts in my workflow is incredible and there’s just something about its arcane, cryptic structure that’s so old school, so sitting in the computer lab back in the mid-80’s (a much more innocent time).

But, try as I might, I’ve never been able to master it to a level that would let me create a pattern like the one above (and have had my share of frustrating days because of it). Which is why the above string is so cool, and why it took me about 17 seconds to save it in BBEdit.  Thanks, John!

(via Daring Fireball)

Looking for something?

Tiny Icons by FamFamFam   •   Subscribe via RSS   •   Powered by Tumblr