Solved

Regular expression to validate a firstname or a lastname

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

713 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