Youness Mourtaji Youness Mourtaji - 11 months ago 57
Java Question

How to split a String at all special characters except dot?

String line="word,1.2;3.1!4.5";


What regex should I use in
Split(...)
to remove all special characters except dot? (I need the dot to keep double and float values)

vks
Answer
(?!\\.)\\W

You can also use this.See demo.

https://regex101.com/r/cD5jK1/4