In search of the perfect URL validation regex
november 2011 by jpcody
Assume that this regex will be used for a public URL shortener written in PHP, so URLs like http://localhost/, //foo.bar/, ://foo.bar/, data:text/plain;charset=utf-8,OHAI and tel:+1234567890 shouldn’t pass (even though they’re technically valid). Also, in this case I only want to allow the HTTP, HTTPS and FTP protocols.
regex
november 2011 by jpcody
jQuery Regular Expressions Review (Rev:20100921_1700)
september 2010 by jpcody
jQuery is a very popular Javascript framework which internally utilizes a number of regular expressions. Most of these regexes work correctly and accurately match (and fail to match) their intended targets. However, quite a few of these can be improved with regard to efficiency (some with regard to matching, others with regard to non-matching - both are important). A comprehensive review of all jQuery regular expressions was recently performed, and this article presents the results of this analysis and offers improved versions. (The jQuery version analyzed was 1.4.3pre: Git commit #747ba7defd82bffa6c7ccb69e53b834cbfddb62c 20-Sep-2010.)
javascript
jquery
regex
september 2010 by jpcody
Daring Fireball: A Liberal, Accurate Regex Pattern for Matching URLs
november 2009 by jpcody
A common problem programming problem: identify the URLs in an arbitrary string of text, where by “arbitrary” let’s agree we mean something unstructured such as an email message or a tweet. I offer a solution, in the form of the following regex pattern:
regex
urls
programming
november 2009 by jpcody