Youness Mourtaji Youness Mourtaji - 4 months ago 20
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
(?!\\.)\\W

You can also use this.See demo.

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

Comments