Check out example codes for "java string regexp replace". It will help you in understanding the concepts better.

Code Example 1

String input = "abcd";
Pattern p = Pattern.compile("regexp");
String output = p.matcher(input).replaceAll("replacement");

Learn ReactJs, React Native from akashmittal.com