我是正则表达式的新手,需要一些帮助。
我有这些句子:
this is a-word
a word this is
aword is this
AWord is this
A-WORD is this
我想知道单词a word
or a-word
or aword
or or AWord
orA-WORD
是否在句子中。
我试过这个:
String sentence = "AWord is this";
String regex = "(a(\\s,'-','')word)\\i";
if (sentence.matches( regex)){
.....
}