[英]Regex Pattern for checking the first letter of each word in a string if its Uppercase in Javascript
for example my string is Foo Bar. 例如我的字符串是Foo Bar。 this string should match the pattern.
此字符串应与模式匹配。
if the string is Foo bar. 如果字符串是Foo bar。 the string should not match.
字符串不应该匹配。
if the string is Foo Bar Foobar the string should match 如果字符串是Foo Bar Foobar,则字符串应该匹配
if the string is Foo. 如果字符串是Foo。 it should also match.
它也应该匹配。
so far I only have this pattern 到目前为止我只有这种模式
(^[A-Z]{1}.*(\s)?$)+
Basically I will only accept a string where each First letter of each word is Uppercase 基本上我只接受一个字符串,每个单词的每个首字母都是大写字母
我会看看你的字符串是否与以下内容不匹配:
/\b[a-z]/
我以前用这个:
#(\s|^)([a-z0-9-_]+)#i
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.