Alex Alex - 2 months ago 15
jQuery Question

Regex to validate a twitter url

I'm using the jQuery validation engine to parse my form data:
https://github.com/posabsolute/jQuery-Validation-Engine

What would be the regex to validate a twitter URL (including the http://twitter.com part) Eg:

http://twitter.com/barackobama
or
http://twitter.com/#!/barackobama

Answer

You mean /http(?:s)?:\/\/(?:www\.)?twitter\.com\/([a-zA-Z0-9_]+)/

Comments