Youness Mourtaji Youness Mourtaji - 1 year ago 74
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 vks
Answer Source
(?!\\.)\\W

You can also use this.See demo.

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