The Java official documentation states:
The string \"boo:and:foo\", for example, yields the following results with these expressions Regex Result :
\"boo:and:foo\"
Use proper escaping: string.split("\\|")
string.split("\\|")
Or, in Java 5+, use the helper Pattern.quote() which has been created for exactly this purpose:
string.split(Pattern.quote("|"))
which works with arbitrary input strings. Very useful when you need to quote / escape user input.