Created
May 24, 2017 04:58
-
-
Save nngogol/995f35d477a3392e63d2fbb9f1b7b94a 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
// | |
// this are the regular expressions for all purposes... | |
//For checking opening and closing tab of specific HTML tags.. | |
<tt class="regex"><TAG\b[^>]*>(.*?)</TAG></tt> | |
//for any HTML tags starting and ending.. | |
<tt class="regex"><([A-Z][A-Z0-9]*)\b[^>]*>(.*?)</\1></tt> | |
//For deleting white spaces from text... | |
<tt class="regex">^[ \t]+|[ \t]+$</tt> | |
//For Checking IP address between 0..255... | |
<tt class="regex">\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.</tt><tt class="regex">(25[0-5]|2[0-4][0-9]|[01]?[0-9]</tt> | |
<tt class="regex">[0-9]?)\.</tt><tt class="regex">(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.</tt><tt class="regex"> | |
<tt class="regex">(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b</tt><tt class="regex"><tt class="regex"><tt class="regex"> | |
//For floating point numbers with sign... | |
<tt class="regex">[-+]?[0-9]*\.?[0-9]+</tt> | |
//for floating point numbers with exponents... | |
<tt class="regex">[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?</tt><tt class="regex"> | |
//For email validation... | |
<tt class="regex">^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$</tt></tt></tt></tt></tt></tt> | |
<tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex">//or you can try for .Museum and etc..</tt></tt></tt></tt></tt></tt> | |
<tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex">^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|biz|info|name|aero|biz|info|jobs|museum|name)$</tt></tt></tt></tt></tt></tt> | |
<tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex"><tt class="regex"> | |
//Date format for yyyy-mm-dd betwwen 1900-01-01 and 2099-12-31 | |
<tt class="regex">(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])</tt> | |
<tt class="regex">//Date format for mm/dd/yyyy betwwen 1900-01-01 and 2099-12-31 | |
<tt class="regex">(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d</tt><tt class="regex"> <tt class="regex"> | |
//Date format for dd-mm-yyyy betwwen 1900-01-01 and 2099-12-31 | |
<tt class="regex">(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d</tt> | |
//finding word in a string.. | |
<tt class="regex">^.*\b(one|two|three)\b.*$ //one,two,three may be your words...</tt> | |
//for deleting duplicate lines from text file... | |
<tt class="regex">^(.*)(\r?\n\1)+$</tt></tt></tt></tt></tt></tt></tt></tt></tt> | |
//For checking digits.. | |
^[0-9] | |
//for checking alphabets... | |
^[a-z]</tt> | |
<tt class="regex">//REgular Expression for some Credit cards validations...</tt> | |
<tt class="regex"> | |
//"Visa" | |
^[4]([0-9]{15}$|[0-9]{12}$) | |
//"MasterCard" | |
^[5][1-5][0-9]{14}$ | |
//"Discover" | |
^6011-?\\d{4}-?\\d{4}-?\\d{4}$ | |
//"Diners Club" | |
(^30[0-5][0-9]{11}$)|(^(36|38)[0-9]{12}$) | |
//"American Express" | |
^[34|37][0-9]{14}$</tt> | |
<tt class="regex"> | |
//"enRoute" | |
^(2014|2149)[0-9]{11}$ | |
//"JCB" | |
^3[0-9]{15}$)|(^(2131|1800)[0-9]{11}$)</tt> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Взято Отсюда: https://www.codeproject.com/Articles/18094/Regular-Expressions-which-are-needed-in-daily-codi