私は正規表現が初めてで、助けが必要です。
私はこれらの文を持っています:
this is a-word
a word this is
aword is this
AWord is this
A-WORD is this
a word
またはa-word
またはaword
またはAWord
またはという単語A-WORD
が文の中にあるかどうか知りたいです。
私はこれを試しました:
String sentence = "AWord is this";
String regex = "(a(\\s,'-','')word)\\i";
if (sentence.matches( regex)){
.....
}