RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 14
Title Test Details To validate the File Type for a FileUploader
Expression
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf)$
Description
You can use this to check the valid file type you have given to the last in the expression like ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf)$ This will accept .pdf only OR ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+((.pdf)|(.doc))$ This will accept .pdf and .doc OR ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+((.pdf)|(.doc)|(.txt))$ This will accept .pdf , .doc and .txt
Matches
C:\Documents and Settings\chandan.kumar\Desktop\1004.pdf
Non-Matches
C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg
Author Rating: The rating for this expression. Chandan Kumar
Title Test Details DECIMAL CHECK (Max 2 digit after Decimal )
Expression
^\d+(?:\.\d{0,2})?$
Description
This will validatet the Number for Max Tow decimal place after a number.. it will validate like 12, 12.1, 12.23; but it will invalidate 12.326
Matches
100,100.1,100.11
Non-Matches
100.123 , 100.1234
Author Rating: The rating for this expression. Chandan Kumar
Title Test Details Define Maximum length to a TextBox
Expression
^(.|\r|\n){1,10}$
Description
This expression can be use to define the maximum length to a textBox. U can change the maximum character by replacing the last numeric value that is 10 in my example. Just change this number to your desired number like ^(.|\r|\n){1,10}$ : for max 10 character ^(.|\r|\n){1,20}$ : for max 20 character
Matches
ChandanKum
Non-Matches
ChandanKuma
Author Rating: Not yet rated. Chandan Kumar
Title Test Details MAX length using regex for Textbox with textmode 'Multiline'
Expression
(.|[\r\n]){1,5}
Description
count the space and new line character also .. pass first parameter for minimun and next for maximum character
Matches
r,rr,rrr,rrrr,rrrrr
Non-Matches
rrrrrr
Author Rating: The rating for this expression. Chandan Kumar
Title Test Details Email validation
Expression
\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
Description
To validate an Email ID
Matches
xyz@gmail.com
Non-Matches
xyz@gmail..com
Author Rating: Not yet rated. Chandan Kumar
Title Test Details Text Between Double Quotes
Expression
"([^\\"]|\\.)*"
Description
to get the text betwwen double quotes
Matches
"Ram", "Ram Shyam"
Non-Matches
ram , shyam
Author Rating: Not yet rated. Chandan Kumar
Title Test Details To Accept DECIMAL or FLOAT
Expression
^([0-9]*|\d*\.\d{1}?\d*)$
Description
This Expression will allow to accept the float or decimal values only. We always got stuck to allow only a decimal in the text area at any index along with numbers
Matches
.123, 123.1, 1.0
Non-Matches
1.1.1; 1.., 0.., .000.1
Author Rating: Not yet rated. Chandan Kumar
Title Test Details To allow certain file type while uploading a file using FileUpload
Expression
\.(?i:)(?:jpg|gif)$
Description
This expression will only allow the .jpg and .gif file to get uploaded. This handles the case of the file type i.e. it will accept .gif and .GIF both and so on .JPG and .jpg.
Matches
mypicture.jpg, MYPICTURE.JPG, MYPICTURE.GIF, mypicture.gif
Non-Matches
mypicture.png, mypicture.bmp
Author Rating: Not yet rated. Chandan Kumar
Title Test Details To Accept Charcters only
Expression
/[a-zA-Z]/
Description
To accept only charactes only for both the cases i.e the Upper Case and the Lower Case
Matches
chandan kumar
Non-Matches
chandan9
Author Rating: Not yet rated. Chandan Kumar
Title Test Details Regex Pattern to replace any special character in a string by any specified character or sting in C#.NET
Expression
['`~!@#&$%^&*()-_=+{}|?><,.:;{}\"\\/\\[\\]]
Description
This Regular Expression Pattern can be used to replace any special character in a string by any other specific character or string. -------------------- Code Example:(in C#) -------------------- string SourceString = TextBox1.Text; string rgPattern = "['`~!@#&$%^&*()-_=+{}|?><,.:;{}\"\\/\\[\\]]"; Regex objRegEx = new Regex(rgPattern);
Matches
chandan`~Kumar@#Singh&*^
Non-Matches
chandan kumar singh
Author Rating: Not yet rated. Chandan Kumar
Title Test Details To find a match pattern in a string
Expression
([Cc][Hh][Aa][Nn][Dd][Aa][Nn].*?)
Description
To find a match pattern in a string not matter where the position of the pattern in the string and even no matter what is the suffix and what will be the prefix.
Matches
Chandan Kumar, Kumar Chandan, Kumar Chandan Singh
Non-Matches
Chanda Kumar, Kumar Chand
Author Rating: Not yet rated. Chandan Kumar
Title Test Details To check a valid IP Address
Expression
\b(?:\d{1,3}\.){3}\d{1,3}\b
Description
To check a valid IP Address. It will check the valid IP address on the logic of three dots max three digits in each section
Matches
192.168.10.210
Non-Matches
192.168.10.256.21
Author Rating: The rating for this expression. Chandan Kumar
Title Test Details To allow non-zero numbers only
Expression
[0-9]*\.?[0-9]*[1-9]
Description
This will validate a match for a number having no zero
Matches
1,99,999,
Non-Matches
10,01,0
Author Rating: Not yet rated. Chandan Kumar
Title Test Details To allow leading and ending ZERO in text box but number greater than ZERO
Expression
^\d*[1-9]\d*$
Description
For a WHOLE number in a text box greater than ZERO. Can start with a Zero, contain Zero in between and end with zero
Matches
01, 100, 990
Non-Matches
0, 00,000
Author Rating: Not yet rated. Chandan Kumar
   Displaying page 1 of 1 pages; Items 1 to 14

Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials