I'm trying to replace few characters matching an expression in a string by name inputPath
such that if inputPath
contains an expression like "json*"
then "json*"
has to removed from that string. I did like this:
String newPath = inputPath.replace("json*","");
When I print newPath
, I am getting string with "json"
being removed but "*"
is not getting removed or replaced. But I need to get entire "json*"
removed or replaced. I just dont understand why it's not replacing "*"
but replacing "json"
only.