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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([1-zA-Z0-1@.\s]{1,255})$
Description
A general string validation to insure no malicious code is being passed through user input. General enough too allow email address, names, address, passwords, so on. Disallows ‘,\*&$<> or other characters that could cause issues.
Matches
[email protected] | My Name | asdf12df
Non-Matches
‘,\*&$<> | 1001' string
Author Rating: Not yet rated. Paul Miller
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: Poor security
Name: JT
Date: 1/8/2015 1:11:45 AM
Comment:
This actually reduces security rather than increases it. In what context could a user submit "malicious code" into a password field? When the developer has written poor code that allows for injection attacks. Don't punish the user for having a secure password.


Title: Correction
Name: Leandro
Date: 1/1/2011 10:06:30 AM
Comment:
I found some issues in order clause. Correction below: ^([a-zA-Z0-9@.\s]{1,255})$


Title: Correction
Name: Leandro
Date: 1/1/2011 10:06:09 AM
Comment:
I found some issues in order clause. Correction below: ^([a-zA-Z0-9@.\s]{1,255})$


Title: fdsfds
Name: ewer
Date: 4/29/2005 7:49:11 AM
Comment:
<!--


Title: Names w/ apostrophes excluded!
Name: a
Date: 12/19/2003 6:45:15 PM
Comment:
Beware if using for names of people and companies: "Smith" validates, but "O'Brien," for example, doesn't. This is a common "gotcha" to look out for.


Title: New expression
Name: CG
Date: 6/6/2003 12:01:23 PM
Comment:
I've posted a small update to this expression http://regexlib.com/REDetails.aspx?regexp_id=317 I haven't fully tested it though, so there might be some problems, but it works a little better (I think) than this one.


Title: Opps
Name: CG
Date: 6/6/2003 11:48:34 AM
Comment:
Forgot the quotes I guess. . . it blocks "&lt" etc. (apersand lt)


Title: Sort of works
Name: CG
Date: 6/6/2003 11:47:26 AM
Comment:
This technically does what it says it does. It blocks &lt &amp and stuff like that, but it doesn't block the literal characters like <>, which is its real problem.


Title: WTF
Name: John
Date: 5/20/2003 8:28:48 PM
Comment:
Uhm... does this RegExp work? It matches everything I type in the tester.


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