Solved

Regular expression to validate a firstname or a lastname

Posted on 2008-11-01
4
932 Views
Last Modified: 2012-05-05
i need to fix the validation express to work for a last name.

ValidationExpression="^[a-zA-Z]{2,}\s[a-zA-Z]{3,}$" ErrorMessage="<b>A valid Last Name name is required,</b><br />


0
Comment
Question by:mathieu_cupryk
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22860333
use this
"^[A-Z]+[a-zA-Z]*$"
0
 

Author Comment

by:mathieu_cupryk
ID: 22860381
the user should at least enter 2 characters
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 22860395
Try this:

"^[A-Z]{1}[a-zA-Z]{1,}$"

0
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22860672
try this


^[a-zA-Z'.\s]{2,8}$"

{2,8} length would be 2 to 8
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now