问题描述
出于网站验证目的,我需要验证名字和姓氏.
For website validation purposes, I need first name and last name validation.
对于名字,它应该只包含字母,可以是几个带有空格的单词,最少三个字符,最多前 30 个字符.不应验证空字符串(例如 Jason、jason、jason smith、jason smith、杰森、杰森史密斯、杰森史密斯和杰森史密斯).
For the first name, it should only contain letters, can be several words with spaces, and has a minimum of three characters, but a maximum at top 30 characters. An empty string shouldn't be validated (e.g. Jason, jason, jason smith, jason smith, JASON, Jason smith, jason Smith, and jason SMITH).
姓氏应该是一个单词,只能是字母,最少三个字符,最多30个字符.不应验证空字符串(例如 lazslo、Lazslo 和 LAZSLO).
For the last name, it should be a single word, only letters, with at least three characters, but at most 30 characters. Empty strings shouldn't be validated (e.g. lazslo, Lazslo, and LAZSLO).
推荐答案
不要忘记以下名称:
- 马蒂亚斯·德阿拉斯
- 小马丁路德金
- Hector Sausage-Hausen
/^[a-z ,.'-]+$/i
这篇关于名字和姓氏的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!