Quantcast
Channel: Splitting a string in java on more than one symbol - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Answer by Deactivator2 for Splitting a string in java on more than one symbol

$
0
0

For that, you need to use an appropriate regex statement. Most of the symbols you listed are reserved in regex, so you'll have to escape them with \.

A very baseline expression would be \+|\-|\\|\*|\=. Relatively easy to understand, each symbol you want is escaped with \, and each symbol is separated by the | (or) symbol. If, for example, you wanted to add ^ as well, all you would need to do is append |\^ to that statement.

For testing and quick expressions, I like to use www.regexpal.com


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>