A general solution using just Java SE APIs is:
String separator = ...
s.split(Pattern.quote(separator));
The quote
method returns a regex that will match the argument string as a literal.
More Related Contents:
- Find the highest number between two literal strings using a Regular Expression
- How to parse a string that contains value only needed partially to an arraylist? [closed]
- How to split a string, but also keep the delimiters?
- Match multiline text using regular expression
- Regex to match a C-style multiline comment
- Regex for matching something if it is not preceded by something else
- Splitting a string at every n-th character
- Parsing XML with REGEX in Java
- Java – Best way to grab ALL Strings between two Strings? (regex?)
- removing invalid XML characters from a string in java
- How do I convert CamelCase into human-readable names in Java?
- Replacing all non-alphanumeric characters with empty strings
- Extracting pairs of words using String.split()
- What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?
- Java String.split() Regex
- Java – regular expression finding comments in code
- Remove all empty lines
- Given a string, generate a regex that can parse *similar* strings
- Regular Expression to match 3 or more Consecutive Sequential Characters and Consecutive Identical Characters
- How to split a comma separated String while ignoring escaped commas?
- java regex capture group
- How to remove HTML tag in Java [duplicate]
- java string split on all non-alphanumeric except apostrophes
- Java String ReplaceAll method giving illegal repetition error?
- Can java.util.regex.Pattern do partial matches?
- Find all words with 3 letters with regex
- Java regex error – Look-behind group does not have an obvious maximum length
- Parse Date from String in this format : dd/MM/yyyy [to dd/MM/yyyy]
- How can I perform a partial match with java.util.regex.*?
- Java replace all square brackets in a string