import java.util.*;
import java.io.*;
import java.util.regex.*;
import java.util.List;
class Program {
String subject
= "This is a string that \"will be\" highlighted when your 'regular expression' matches something."; Pattern regex = Pattern.compile("'[^']*'|\"[^\"]*\"|( )");
Matcher m = regex.matcher(subject);
while (m.find()) {
if(m.group(1) != null) m.appendReplacement(b, "SplitHere");
else m.appendReplacement(b, m.group(0));
}
m.appendTail(b);
String replaced
= b.
toString(); String[] splits
= replaced.
split("SplitHere"); } // end main
} // end Program
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5pby4qOwppbXBvcnQgamF2YS51dGlsLnJlZ2V4Lio7CmltcG9ydCBqYXZhLnV0aWwuTGlzdDsKCmNsYXNzIFByb2dyYW0gewpwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24JewoKU3RyaW5nIHN1YmplY3QgPSAiVGhpcyBpcyBhIHN0cmluZyB0aGF0IFwid2lsbCBiZVwiIGhpZ2hsaWdodGVkIHdoZW4geW91ciAncmVndWxhciBleHByZXNzaW9uJyBtYXRjaGVzIHNvbWV0aGluZy4iOwpQYXR0ZXJuIHJlZ2V4ID0gUGF0dGVybi5jb21waWxlKCInW14nXSonfFwiW15cIl0qXCJ8KCApIik7Ck1hdGNoZXIgbSA9IHJlZ2V4Lm1hdGNoZXIoc3ViamVjdCk7ClN0cmluZ0J1ZmZlciBiPSBuZXcgU3RyaW5nQnVmZmVyKCk7CndoaWxlIChtLmZpbmQoKSkgewogICAgaWYobS5ncm91cCgxKSAhPSBudWxsKSBtLmFwcGVuZFJlcGxhY2VtZW50KGIsICJTcGxpdEhlcmUiKTsKICAgIGVsc2UgbS5hcHBlbmRSZXBsYWNlbWVudChiLCBtLmdyb3VwKDApKTsKfQptLmFwcGVuZFRhaWwoYik7ClN0cmluZyByZXBsYWNlZCA9IGIudG9TdHJpbmcoKTsKU3RyaW5nW10gc3BsaXRzID0gcmVwbGFjZWQuc3BsaXQoIlNwbGl0SGVyZSIpOwpmb3IgKFN0cmluZyBzcGxpdCA6IHNwbGl0cykgU3lzdGVtLm91dC5wcmludGxuKHNwbGl0KTsKfSAvLyBlbmQgbWFpbgp9IC8vIGVuZCBQcm9ncmFt