String[] splitArray = subjectString.split("(?<!(?<!\\\\)\\\\);");
Это должно работать.
Объяснение:
// (?<!(?<!\\)\\);
//
// Assert that it is impossible to match the regex below with the match ending at this position (negative lookbehind) «(?<!(?<!\\)\\)»
// Assert that it is impossible to match the regex below with the match ending at this position (negative lookbehind) «(?<!\\)»
// Match the character “\” literally «\\»
// Match the character “\” literally «\\»
// Match the character “;” literally «;»
Таким образом, вы просто сопоставляете точку с запятой, не предшествующую ровно одной \
.
РЕДАКТИРОВАТЬ:
String[] splitArray = subjectString.split("(?<!(?<!\\\\(\\\\\\\\){0,2000000})\\\\);");
Это будет заботиться о любом нечетном числе. конечно потерпит неудачу, если у вас более 4000000 номеров \.Объяснение отредактированного ответа:
// (?<!(?<!\\(\\\\){0,2000000})\\);
//
// Assert that it is impossible to match the regex below with the match ending at this position (negative lookbehind) «(?<!(?<!\\(\\\\){0,2000000})\\)»
// Assert that it is impossible to match the regex below with the match ending at this position (negative lookbehind) «(?<!\\(\\\\){0,2000000})»
// Match the character “\” literally «\\»
// Match the regular expression below and capture its match into backreference number 1 «(\\\\){0,2000000}»
// Between zero and 2000000 times, as many times as possible, giving back as needed (greedy) «{0,2000000}»
// Note: You repeated the capturing group itself. The group will capture only the last iteration. Put a capturing group around the repeated group to capture all iterations. «{0,2000000}»
// Match the character “\” literally «\\»
// Match the character “\” literally «\\»
// Match the character “\” literally «\\»
// Match the character “;” literally «;»