This discussion is archived
6 Replies Latest reply: Nov 2, 2012 3:33 AM by Kayaman RSS

how to create a regex to match a certain pattern for string abc*def*

971973 Newbie
Currently Being Moderated
I have a requirement in which i have a string like abc*def* and i want to remove * from this string and also i want to remove a character before * and after *.
So, if i have string abc*def* then i want the result as abe.

Can you please let me know what regex i can use in String.replaceAll method ? I can do it with using for loop as well but i think using replaceAll will be much cleaner.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points