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.
文字列からキャメルケース要素を見つけようとしています。例:iOS
iOS
以下は、しようとしているものです:
token.matches("(a-z)+(//W)")
しかし、キャメルケースの単語は拾っていません。
助けていただければ幸いです
次の正規表現を使用します。
"[a-z]+[A-Z]+"
(a-z)+リテラルa-zに 1 回以上一致し、(//W)リテラルに 1 回一致し//Wます。
(a-z)+
a-z
(//W)
//W
角括弧は、括弧ではなく文字範囲に使用されます。
という意味であれば、これは「単語の文字ではない」という意味\\Wの と同等です。[^\\w]句読点やスペースなどのマッチングになります。
\\W
[^\\w]