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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([a-zA-Z0-9!@#$%^&*()-_=+;:'"|~`<>?/{}]{1,5})$
Description
This Regular expression validates a string that contains all printable characters with a minimum length of 1 and maximum length of 5. Obviously the min and max can be changed to meet the users needs. ^([a-zA-Z0-9!@#$%^&*()-_=+;:'"|~`<>?/{}]{1,5})$ This is the string, I keep getting &lt and other characters when I save it.
Matches
ilove | $%*!_ | it
Non-Matches
123456 | This is great
Author Rating: Not yet rated. Michael Matusiewicz
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Works by accident
Name: Michael Ash
Date: 8/9/2004 4:44:16 PM
Comment:
This regex does work but not for the obvious reasons and modification isn't as simply as it looks. If you remove A-Z or 0-9 from this expression it will still match those characters. What really happening is the portion of reg ')-_' is matching 55 characters, including uppercase letters, digits and some left out of the regex. See http://blogs.regexadvice.com/mash/archive/2004/06/17/1272.aspx if you don't understand why Also ^[!-~]{1,5}$ accomplishes what the author intended.


Title: Works just as it says
Name: Stephen Rylander
Date: 8/9/2004 1:21:59 PM
Comment:
Simple to modify and use.


Title: Works
Name: Gerald P. Roston
Date: 12/1/2003 1:48:04 PM
Comment:
Works as it is supposed to


Title: Doesn't work
Name: Gerald P. Roston
Date: 12/1/2003 12:33:44 PM
Comment:
Will not flag entries that are too short as being invalid.


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