Reputation: 171
i wrote Regex .*?(?=;)|(?<=;).*
which have to take values between semicolons. My text: 2014-01-01 00:01:00;;16;4;0;0;1
. Actual it parsing string to this:
[2014-01-01 00:01:00, , , 16, , 4, , 0, , 0, , 1]
.
It replaces semicolons to spaces, which is unwanted feature of course, how to fix it ?
Upvotes: 1
Views: 64
Reputation: 174786
Just do splitting on one or more semi-colons.
string.split(";+");
or
Match any character but not of ;
one or more times.
Pattern.compile("[^;]+");
Upvotes: 1