I have a String which i need to split based on the space and the exact matching quotes.
If the
string = \"It is fun \\\"to write\\\" regular\\\"expressi
The trick is to use a flexible look ahead to assert that:
I got it into one line, but it's a whopper:
String[] parts = str.split("(\\s+|(?
This correctly splits the example string with or without the trailing quote (whether or not the trailing term includes a space).