Quantcast
Channel: CodeProject Latest postings for Regular Expressions
Viewing all articles
Browse latest Browse all 224

Help with regex HTML form validation Part 2

$
0
0
Hi,

Now I need a pattern to detect last name possibilities. I think this pattern will be slightly more complicated. Names that I see in the database are like:

Jones
Jones-Smith
Jones Smith (no hyphen)
O'Leary
Van Allen (no hyphen)
Vander Ark (no hyphen)

I think that this pattern will work but I would like public opinion to make sure I am getting this right:

^[a-zA-Z\-\s']+$

Can you think of any last names where this will not work? In testing it seems to work out alright.

Thanks,
Rob

Viewing all articles
Browse latest Browse all 224

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>