Java regex matching for substring replacement

How do I replace all occurrences of a java substring like stuff = "- 9888777666", stuff = "123", with stuff = "0" substring? The double quotes are actually part of the string.

+2


source to share


1 answer


Have a look at the explanation of regex in the java docs :



string = string.replaceAll("stuff=\"-?\\d+\"", "stuff=\"0\"");

      

+4


source







All Articles