Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
正規表現用のJavaプログラムを作成しました。これらの「N」、「E」、「W」、「S」以外の文字がテキストに含まれている場合、実際にfalseを返す正規表現を探しています。このPattern.matches( "[^ NWES]"、str)をプログラムで使用しましたが、機能しませんでした。
正規表現で数量詞を使用する必要があります:-
return Pattern.matches("[NWES]+", str);