Regular Expression Collection

Opening and Closing HTML/XML Tags: Regex(“\s]+))?)+\s*|\s*)/?>”);

Self Closing HTML/XML Tags: Regex(“\s]+))?)+\s*|\s*)/>”);

Opening and Closing HTML/XML Tags: s]+))?)+s*|s*)/?>Locates Malicious Characters in User Input: ^[^`~!/@#}$%:;)(_^{&*=|’+]+$

Locates SQL Queries: (SELECTs[w*)(,s]+sFROMs[w]+)| (UPDATEs[w]+sSETs[w,’=]+)| (INSERTsINTOs[dw]+[swd)(,]*sVALUESs([dw’,)]+)| (DELETEsFROMs[dw’=]+)

Extracts Colors: ^(#){1}([a-fA-F0-9]){6}$

AMEX: ^([34|37]{2})([0-9]{13})$

Visa: ^([4]{1})([0-9]{12,15})$

Discover: ^([6011]{4})([0-9]{12})$

MC: ^([51|52|53|54|55]{2})([0-9]{14})$

Diners: ^([30|36|38]{2})([0-9]{12})$

US Phone Number: ^({1}[2-9]{1}[0-9]{2}){1}[ ]?[2-9]{1}[0-9]{2}(-| )?[0-9]{4}|[2-9]{1}[0-9]{2}[ ]{1}[2-9]{1}[0-9]{2}[ ]{1}[0-9]{4}|[2-9]{1}[0-9]{2}[2-9]{1}[0-9]{6}|[2-9]{1}[0-9]{2}-{1}[2-9]{1}[0-9]{2}-{1}[0-9]{4}){1}$

SSN: ^d{3}-d{2}-d{4}$

Password: ^(?=[^d_].*?d)w(w|[!@#$%]){7,20}

GUID: ^[{|(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[)|}]?$

Email: ^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$

Date mm/dd/yyyy: (0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)dd

File Extensions: ^.*(([^.][.][wW][mM][aA])|([^.][.][mM][pP][3]))$

Alphanumeric Strings: ^w+$

Alphanumeric with Spaces: ^[ws]+$

XML Namespaces: xmlns=”((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)”

Published by

Tim Clark

Experienced Business Owner, Chief Information Officer, Vice President, Chief Software Architect, Application Architect, Project Manager, Software Developer, Senior Web Developer, Graphic Designer & 3D Modeler, University Instructor, University Program Chair, Academic Director. Specialties: Ruby, Ruby on Rails, JavaScript, JQuery, AJAX, Node.js, React.js, Angular.js, MySQL, PostgreSQL, MongoDB, SQL Server, Responsive Design, HTML5, XHTML, CSS3, C#,, Project Management, System Design/Architecture, Web Design, Web Development, Adobe CS6 (Photoshop, Illustrator)

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s