I have a string for e.g.
String src = \"How are things today /* this is comment *\\*/ and is your code /*\\* this is another comment */ working?\" >
String src = \"How are things today /* this is comment *\\*/ and is your code /*\\* this is another comment */ working?\"
System.out.println(src.replaceAll("\\/\\*.*?\\*\\/ ?", ""));
You have to use the non-greedy-quantifier ? to get the regex working. I also added a ' ?' at the end of the regex to remove one space.