Solved

Regular expression to validate a firstname or a lastname

Posted on 2008-11-01
4
923 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

10 Experts available now in Live!

Get 1:1 Help Now