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.
split(regex) 関数を使用して文字列を配列に分割するのが好きです。
セミコロンで分割したいのですが、文字列 ( ) には、分割に使用してはならない;「エスケープされた」セミコロンもあります。\;
;
\;
.split(regex)これを行う関数の正規表現はありますか?
.split(regex)
前に: -negative look-behindを付けずに分割するために使用します。semi-colon\\
negative look-behind
semi-colon
\\
str.split("(?<!\\\\);");
使用する必要があり4 backslashesます-Javaのバックスラッシュを1回エスケープしてから、正規表現の2つのバックスラッシュを再度エスケープします。
4 backslashes