I’m looking to split a string using Java if it contains a digit or underscore – but I want to include the digit in the result – is this possible?
Eg.
“Linux_version”
“Linux3.1.2.x”
I want to split strings like these to get either “version” if it contains an underscore, or the digits to the end of the string if it contains a digit – e.g. from the second string above – I want “3.1.2.x”
Any help is much appreciated!
If you just want to remove
LinuxorLinux_, try this: