Construct a regular expression of the form
delim1|delim2|delim3
then use String
's split()
method to split the text by any of the delimiters.
In order to construct the regexp, read each delimiter, and pass it to Pattern.quote
before appending to the regex that you build. This would let your delimiters use regex metacharacters as well.