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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
(?=^.{6,51}$)([A-Za-z]{1})([A-Za-z0-9!@#$%_\^\&\*\-\.\?]{5,49})$
Description
This expression was originally developed for user names. Matching text must have 6 - 50 characters, cannot contain spaces, must begin with an alpha character, can contain mixed case alpha, digits, and the following special characters: ! @ # $ % ^ & * - . _ ?
Matches
aB!@#%&^$.?*-0123456789Yz | [email protected] | Excla!Us_er
Non-Matches
1234567890 | aB1()[]{};:'",<>/\_=0Yz | !exclaUser
Author Rating: The rating for this expression. John Tobler
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: Thanks for the RegEx
Name: Gagan
Date: 7/28/2008 7:22:45 AM
Comment:
I modified your Pattern. I took a more general approach. (?=^.{3,21}$)([A-Za-z]{1})([A-Za-z0-9_\.]{2,20})$ It accepts user names which are of length 3-20 Characters Special Characters allowed: . and _ I think more special characters, more SQL Injection.


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