Java Regex String Replace All replaceAll(String string, Pattern[] patterns, String replacement)

Here you can find the source of replaceAll(String string, Pattern[] patterns, String replacement)

Description

replace All

License

Apache License

Declaration

public static String replaceAll(String string, Pattern[] patterns, String replacement) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.regex.Pattern;

public class Main {
    public static String replaceAll(String string, Pattern[] patterns, String replacement) {
        if (string == null || string.length() == 0) {
            return string;
        }/*from w  ww . jav a 2  s.  c o  m*/
        if (patterns != null) {
            for (Pattern pattern : patterns) {
                string = pattern.matcher(string).replaceAll(replacement);
            }
        }
        return string;
    }
}

Related

  1. replaceAll(String source, Pattern pattern, String replace)
  2. replaceAll(String str, String originalToken, String replacementToken)
  3. replaceAll(String str, String regex, String replacement)
  4. replaceAll(String str, String regex, String replacement)
  5. replaceAll(String string, Pattern pattern, String repalStr)
  6. replaceAll(String target, String from, String to)
  7. replaceAll(String text, Pattern pattern, String replace)
  8. replaceAll(StringBuilder sb, String regex, String replacement)
  9. replaceAllBackreference(String text, String regex, String replacement)