求一正则表达式!急!
A-Z (upper case)
a-z (lower case)
' (like D 'Ambrosio)
- (like Thorne-Smith)
<space> (like Thorne Smith)
Last Name - Must be at least 2 chars, IF 2 chars - cant be same two
chars. (ie no Aa as a last name) Perfect world - FIRST char must
be a A-Z or a-z.
First Name can be 1 char or more from valid list above. Perfect world -
FIRST char must be a A-Z or a-z
我想写一个这样的pattern,我试了一下 这样写
Pattern p = Pattern.compile( "([a-z]|[A-Z]+)\\S*\\.*\\-*([a-z]|[A-Z]*) ");
我以为\\s 代表space * 是一个或者多个。但是实际是不对的 a1 也能匹配这个模式
我该怎么写呢? 急
------解决方案--------------------空白字符是小s,不是大s啊,你写的那个Pattern是大s