![]() |
Web Development »
ASP.NET »
General
Beginner
License: The GNU General Public License (GPL)
Regular Expressions which are needed in daily coding...By JustChiragPatelRegular Expressions for all purpose.. |
Windows, .NET1.1, .NET2.0, ASP.NET, WebForms, VS.NET2003, VS2005, Dev
|
||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Guys , we all know that regular expressions are very useful for checking any kind of patterns.
// // this are the regular expressions for all purposes... //For checking opening and closing tab of specific HTML tags.. "regex"><TAG\b[^>]*>(.*?)</TAG> //for any HTML tags starting and ending.. "regex"><([A-Z][A-Z0-9]*)\b[^>]*>(.*?)</\1> //For deleting white spaces from text... "regex">^[ \t]+|[ \t]+$ //For Checking IP address between 0..255... "regex">\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\."regex">(25[0-5]|2[0-4][0-9]|[01]?[0-9] "regex">[0-9]?)\."regex">(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\."regex"> "regex">(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"regex">"regex">"regex"> //For floating point numbers with sign... "regex">[-+]?[0-9]*\.?[0-9]+ //for floating point numbers with exponents... "regex">[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"regex"> //For email validation... "regex">^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$ "regex">"regex">"regex">"regex">"regex">"regex">//or you can try for .Museum and etc.. "regex">"regex">"regex">"regex">"regex">"regex">^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|biz|info|name|aero|biz|info|jobs|museum|name)$ "regex">"regex">"regex">"regex">"regex">"regex"> //Date format for yyyy-mm-dd betwwen 1900-01-01 and 2099-12-31 "regex">(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01]) "regex">//Date format for mm/dd/yyyy betwwen 1900-01-01 and 2099-12-31 "regex">(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d"regex"> "regex"> //Date format for dd-mm-yyyy betwwen 1900-01-01 and 2099-12-31 "regex">(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d //finding word in a string.. "regex">^.*\b(one|two|three)\b.*$ //one,two,three may be your words... //for deleting duplicate lines from text file... "regex">^(.*)(\r?\n\1)+$ //For checking digits.. ^[0-9] //for checking alphabets... ^[a-z] "regex">//REgular Expression for some Credit cards validations... "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}$ "regex"> //"enRoute" ^(2014|2149)[0-9]{11}$ //"JCB" ^3[0-9]{15}$)|(^(2131|1800)[0-9]{11}$)
I like to Share my knowledge with you, because i am also one of you, taht if i don't know anything then i come to you...so keep excahnge of knowledge...
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 21 Mar 2007 Editor: |
Copyright 2007 by JustChiragPatel Everything else Copyright © CodeProject, 1999-2010 Web19 | Advertise on the Code Project |