String.replaceAll(String regex, String replacement) has the following syntax.
public String replaceAll(String regex, String replacement)
In the following code shows how to use String.replaceAll(String regex, String replacement) method.
public class Main { public static void main(String args[]) { String str = "This is a test from java2s.com."; System.out.println(str.replaceAll("is", "are")); } }
The code above generates the following result.