【发布时间】:2021-08-23 21:46:11
【问题描述】:
这会检查两个单词,但如果单词包含数字,也会返回 true。那么,如何使用此正则表达式检查句子中仅包含字母的两个单词?
Regex.IsMatch(alphabets, @"^((?:\S+\s+){2}\S+).*");
//should return true if string is Honda Civic
//should return false if string is Honda Civic TypeR
//should return false if string is H56da Civic
//should return false if string is Honda
【问题讨论】: