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.
文字列リテラルを改行 (\n) とキャリッジ リターン (\r) の両方の文字と一致させるのに苦労しています。例えば:
"132 Holt Court, Cashtown, Rhode Island, 7680 \n\r"
私が試したのは
\"([^\\\"]|\\.)*\"
しかし、この正規表現は、\r. 誰でもこれで私を助けることができますか?
\r
ありがとうございました。
チェックの前に、いつでも最初にそれらを削除できます。
例えば:
String s = "132 Holt Court, Cashtown, Rhode Island, 7680 \n\r" s=s.replace("\\n\\r","\\n");