I have a string a follows
String caret= "Y^LEAD_PROJECT_V.vw^View LEAD_PROJECT_V.vw^INF^View^Extension^RECOMPILE^Unit Test^Recompile - Test ^Test View PROJECT_V.vw^^SIMPLE^^^^^^^";
I want to split this string with ^
. So I used the following code to split it
String[] split = caret.split("\\^");
System.out.println(split.length);
split.length
obtained :
12
split.length
required:
19 // as there are 18 caret symbols in the string
I don't understand what am I doing wrong in it. Whatever regex I use, I'm getting the same result. Also I cannot modify the string caret
.
Can anyone please help me in getting 19
as array length.