- Email:
^[a-zA-Z0-9_.+-][email protected][a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$
- URL or Domain name:
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
- Date (MM/DD/YYYY)/(MM-DD-YYYY)/(MM.DD.YYYY)/(MM DD YYYY):
^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$
- 12 months of the year(01~09和1~12):
^(0?[1-9]|1[0-2])$
- 31 days a month(01~09和1~31):
^(0[1-9]|[12][0-9]|3[01])$
- Password:
^.*(?=.{6,})(?=.*d)(?=.*[A-Z])(?=.*[a-z])(?=.*[[email protected]#$%^&*? ]).*$
- US Phone Numbers
\b\d{3}[-.]?\d{3}[-.]?\d{4}\b
- US Zip code
^[0-9]{5}(?:-[0-9]{4})?$
- Slug
^[a-z0-9-]+$
- All the special characters need to be escaped
/[\-\[\]\/\\\{\}\(\)\*\+\?\.\^\$\|]/
- xml file:
^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$
- Regular expressions for Chinese characters:
[\u4e00-\u9fa5]
- Double-byte characters:
[^\x00-\xff]
- Blank line:
\n\s*\r (be used to delete blank lines)
- HTML tags:
<(\S*?)[^>]*>.*?|<.*? />
- The leading and trailing whitespace character:
^\s*|\s*$ or (^\s*)|(\s*$)
- IP address:
((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))