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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -