I have a java string of form “a_x,b_y,c_z”.
I would like to get rid of chunk before _ and after , .
So I need to get x,y,z.
How can I achieve this?
I am trying to make String.replaceAll(",*_",",") work but get error:
Exception in thread “main” java.util.regex.PatternSyntaxException: Dangling meta character ‘*’ near index 0
Please help.
this works for me:
It depends on what you need to replace, I’m considering just characters in the class \w, but you can tweak this part to match whatever you like.