Regular Expressions

I’m currently working on validations using regular expressions and I thought I’d share some of them or bookmark them for later use.

Instagram post
^(((https?):\/)?\/?)?(www\.)?instagram\.com\/p\/[A-Za-z0-9]+(\/\?((taken\-by)|(tagged))\=([A-Za-z0-9_](?:(?:[A-Za-z0-9_]|(?:\.(?!\.))){0,28}(?:[A-Za-z0-9_]))?))?$

Instagram handle
([A-Za-z0-9_](?:(?:[A-Za-z0-9_]|(?:\.(?!\.))){0,28}(?:[A-Za-z0-9_]))?)
from jstassen

Email
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s