I have a String = \"Hello-new-World\". And when i use the split() method with different regex values, it acts differently.
String str = \"Hello-new-world\" Strin
Pipe is special regex symbol which means OR, if you want to split by pipe then escape it in your regex:
OR
String[] strbuf = str.split("\\|");
String[] strbuf = str.split("[|]");