Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 用于验证大写全名(包括unicode字符)的正则表达式?_Regex_Validation_Unicode_Google Forms - Fatal编程技术网

Regex 用于验证大写全名(包括unicode字符)的正则表达式?

Regex 用于验证大写全名(包括unicode字符)的正则表达式?,regex,validation,unicode,google-forms,Regex,Validation,Unicode,Google Forms,我正在创建一个Google表单,并在文本/段落文本选项中使用数据验证功能。我需要确认人们的名字。名称需要用大写字母填写,并且可能有可变字数。名称可以是“FIRSTNAME-LASTNAME”或“FIRSTNAME-MIDDLENAME-LASTNAME”或“FIRSTNAME-MIDDLENAME1-MIDDLENAME2-LASTNAME”等 另一件事是,一些名称包括来自土耳其和葡萄牙字母表的字符,将来也可能包括来自西里尔字母表的字符。我如何在正则表达式中包含所有这些可能性?如果能解释一下所用

我正在创建一个Google表单,并在文本/段落文本选项中使用数据验证功能。我需要确认人们的名字。名称需要用大写字母填写,并且可能有可变字数。名称可以是“FIRSTNAME-LASTNAME”或“FIRSTNAME-MIDDLENAME-LASTNAME”或“FIRSTNAME-MIDDLENAME1-MIDDLENAME2-LASTNAME”等

另一件事是,一些名称包括来自土耳其和葡萄牙字母表的字符,将来也可能包括来自西里尔字母表的字符。我如何在正则表达式中包含所有这些可能性?如果能解释一下所用的表达方式,那也太好了


附言:我查过了,但是1。它仅对名称、姓氏和2有效。它还包括小写字母。

其中一个字母可能会给你一些想法-

 # --------------------
 # To capture names, first/last name required
 # \s*\p{Lu}+(?:\s+\p{Lu}+)*\s+\p{Lu}+\s*
 # --------------------

 \s*                       # some boundry                  (optional)
 ( \p{Lu}+ )               # (1), upper case first name    (required) 
 (                         # (2), upper case middle names  (optional)
      (?: \s+ \p{Lu}+ )*
 )
 \s+                       # some boundry                  (required) 
 ( \p{Lu}+ )               # (3), upper case last name     (required) 
 \s*                       # some boundry                  (optional)


 # --------------------
 # Or, if no boundry and only first name required
 # \p{Lu}+(?:\s+\p{Lu}+)*
 # --------------------

 \p{Lu}+ 
 (?: \s+ \p{Lu}+ )*


 # --------------------
 # Or, if no boundry and first/last name required
 #\p{Lu}+(?:\s+\p{Lu}+)+
 # --------------------

 \p{Lu}+ 
 (?: \s+ \p{Lu}+ )+

其中一个可能会给你一些想法

 # --------------------
 # To capture names, first/last name required
 # \s*\p{Lu}+(?:\s+\p{Lu}+)*\s+\p{Lu}+\s*
 # --------------------

 \s*                       # some boundry                  (optional)
 ( \p{Lu}+ )               # (1), upper case first name    (required) 
 (                         # (2), upper case middle names  (optional)
      (?: \s+ \p{Lu}+ )*
 )
 \s+                       # some boundry                  (required) 
 ( \p{Lu}+ )               # (3), upper case last name     (required) 
 \s*                       # some boundry                  (optional)


 # --------------------
 # Or, if no boundry and only first name required
 # \p{Lu}+(?:\s+\p{Lu}+)*
 # --------------------

 \p{Lu}+ 
 (?: \s+ \p{Lu}+ )*


 # --------------------
 # Or, if no boundry and first/last name required
 #\p{Lu}+(?:\s+\p{Lu}+)+
 # --------------------

 \p{Lu}+ 
 (?: \s+ \p{Lu}+ )+

为什么他们需要在首都?大多数人不会用大写字母写自己的名字。因为名字是用来打印名片的,我们在上面用大写字母。输出文件将直接发送到打印机。这很公平。但是你不能接受混合大小写,然后在内部转换成大写吗?(即使用正则表达式的任何语言都可能有一个
strtoupper()
或类似的?)为什么它们需要大写?大多数人不会用大写字母写自己的名字。因为名字是用来打印名片的,我们在上面用大写字母。输出文件将直接发送到打印机。这很公平。但是你不能接受混合大小写,然后在内部转换成大写吗?(即使用正则表达式的任何语言都可能有一个
strtoupper()
或类似的?)