java - Delete characters between other -
I have too many sentences and "ga-te", "ga-te" etc. in this string. I do not need to change all words like "Gate" from "Ga-Te" and touch each other. I tried to use regexp but it failed. Can you help me with this? Sorry for my bad english
You can place in the place you want to keep and see those groups in the replacement call .
string s = "ga-te, ga - te, foo-bar"; S = s.replaceAll ("([a-z]) * - * ([a-z])", "$ 1 $ 2"); Println (s); // = & gt; "Gate, Gate, Fobar"
Comments
Post a Comment