Java String.replaceAll() Method Example

The String.replaceAll(String regex, String replacement) method replaces each substring of this string that matches the given regular expression with the given replacement.

Java String.replaceAll() Method Example

This is a complete example to demonstrate the usage of replaceAll()  methods.
public class ReplaceAllExample {
    public static void main(String[] args) {
        String str = "javaguides";
        String subStr = str.replaceAll("[a-z]", "java");



Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course