Here's a really quick summary for commonly used Regular Expressions

Common (but hard to find) Regular Expressions

I've found and hacked all these through several months of use and need. Feel free to use them for your own needs. Happy Coding!

Http(s) URL Regex

http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?

Email Regex

^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$

Mexican RFC Regex

^[a-zA-Z]{3,4}(\d{6})((\D|\d){3})?$

And my personal favorite:

GUID Regex:

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

Currency Regex:

^(?!\(.*[^)]$|[^(].*\)$)\(?\$?\s*(0|[1-9]\d{0,2}(,?\d{3})?)(\.\d\d?)?\)?$
Posted by: fabzter
Last revised: 03 Mar, 2014 01:59 PM History

Comments

Your Comments

Used for your gravatar. Not required. Will not be public.
Posting code? Indent it by four spaces to make it look nice. Learn more about Markdown.

Preview