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 正規表現を探しています。
DigitOperandDigit
数字は 0 ~ 9 の数字で、オペランドは のいずれかです+-/*。
+-/*
例:
1+1 2/4
この式は機能するはずです:
\d[*/+-]\d
そして使用中:
if (string.matches("\d[*/+-]\d")) { // ... }