Created
January 15, 2020 10:11
-
-
Save adedayojs/ea2dca8cf4f7eca4d8ad8c65ecf086c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Email address | |
^[\\w\\-]+(\\.[\\w\\-]+)*@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}$ | |
^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$ | |
^([\w\.*\-*]+@([\w]\.*\-*)+[a-zA-Z]{2,9}(\s*;\s*[\w\.*\-*]+@([\w]\.*\-*)+[a-zA-Z]{2,9})*)$ //List of semi-colon seperated email addresses | |
^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})*$ | |
// IP Address | |
^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$ | |
// Credit Cards | |
^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$ | |
// Username of type test@test | |
[^@/]+@[^@/]+ | |
// Multiple spaces replacement | |
\\s+ | |
// Non-alphanumeric replacement | |
[^a-zA-Z0-9] | |
// Blank line | |
^$ | |
// Positive integers | |
^[1-9]+[0-9]*$ | |
// Positive decimal values | |
(^\d*\.?\d*[0-9]+\d*$)|(^[0-9]+\d*\.\d*$) | |
// Percentage (2 decimal places) | |
^-?[0-9]{0,2}(\.[0-9]{1,2})?$|^-?(100)(\.[0]{1,2})?$ | |
// State abbreviation | |
[A-Z][A-Z] //you may choose to put spaces either before or after the regex. | |
// Phone Numbers | |
(^\+[0-9]{2}|^\+[0-9]{2}\(0\)|^\(\+[0-9]{2}\)\(0\)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9\-\s]{10}$) | |
// City, State abbreviation | |
.*, [A-Z][A-Z] | |
// Zip Code | |
[0-9]\{5\}(-[0-9]\{4\})? //84094 or 84094-1234 | |
// Social security number, such as: ###-##-#### | |
[0-9]\{3\}-[0-9]\{2\}-[0-9]\{4\} | |
// Dollar amounts, specified with a leading $ symbol | |
\$[0-9]*.[0-9][0-9] | |
// DATE | |
[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} //2003-08-06 | |
[A-Z][a-z][a-z] [0-9][0-9]*, [0-9]\{4\} //Jan 3, 2003 | |
^(\d{1,2})\/(\d{1,2})\/(\d{2}|(19|20)\d{2})$ //DD/MM/YY or DD/MM/YYYY or MM/DD/YY or MM/DD/YYYY | |
// HTML Tags except <p> </p> | |
<(?>/?)(?!p).+?> | |
// Font Tags Replacement | |
<(FONT|font)([ ]([a-zA-Z]+)=("|')[^"\']+("|'))*[^>]+>([^<]+)(</FONT>|</font> | |
// URL | |
^http(s)?:\/\/((\d+\.\d+\.\d+\.\d+)|(([\w-]+\.)+([a-z,A-Z][\w-]*)))(:[1-9][0-9]*)?(\/([\w-.\/:%+@&=]+[\w- .\/?:%+@&=]*)?)?(#(.*))?$/i | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment