using only regular expression methods, the method String.replaceAll and ArrayList
how can i split a String into tokens, but ignore delimiters that exist inside quotes?
the delimiter is any character that is not alphanumeric or quoted text
for example:
The string :
hello^world’this*has two tokens’
should output:
- hello
- worldthis*has two tokens
Use a
Matcherto identify the parts you want to keep, rather than the parts you want to split on:See it working online: ideone