This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes Regular expression for username Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Regular expression for username" Watch "Regular expression for username" New topic
Author

Regular expression for username

vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Hi all

I am trying to validate username using validator rules

For my username, the requirements are

First character should be a-z,A-Z
Remaining characters can be a-z,A-Z,0-9,_

i want regular expression to include in the mask

I tried giving ^[a-zA-z]\d{1}[a-zA-Z0-9_]\d{2,25}

its not working,

Hope anyone correct me

Thanks in advance
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
I got it


^[a-zA-Z\.]{1}[a-zA-Z0-9_]{2,25}$

Sorry for the trouble
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Regular expression for username
 
It's not a secret anymore!