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-Z]|[a-z]|[0-9])([A-Z]|[a-z]|[0-9]|([A-Z]|[a-z]|[0-9]|(%|&|'|\+|\-|@|_|\.|\ )[^%&'\+\-@_\.\ ]|\.$|([%&'\+\-@_\.]\ [^\ ]|\ [%&'\+\-@_\.][^%&'\+\-@_\.])))+$
Description
This works good for account names where u don't want your users to create ugly account names. 3 rules apllied in it: 1. an account name must start with Letter or Number 2. the only valid signs are : ^%&'+-@. and (space (chr32)) 3. a sign can't be repeated by any sign execept space which can't be repeated as well.
Matches
AccountName_123 | ABC & DEF Inc. | [email protected]
Non-Matches
-=superman=- | $$ Money Man $$ | Lord -- Foo
Author Rating: The rating for this expression. Gil Y
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: From Gil Y
Name: Gil Y
Date: 8/20/2004 10:51:34 PM
Comment:
It took a day for me to get to that..(well i discovered regex only 2 days ago) it wasn't easy but it works exactly as intentioned, for some reason negating a repeated char seem to be hard task to program with regex, and that's why I hope you find that expression useful.


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