Java Regex String Replace All replaceAll(String regex, String ment, String str)

Here you can find the source of replaceAll(String regex, String ment, String str)

Description

replace All

License

Open Source License

Declaration

public static String replaceAll(String regex, String ment, String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static String replaceAll(String regex, String ment, String str) {
        return replaceAll(regex, ment, str, Pattern.CASE_INSENSITIVE);
    }/*from  ww w.  j a  v  a  2s. com*/

    public static String replaceAll(String regex, String ment, String str,
            int flags) {
        Pattern pat = null;
        if (flags == -1) {
            pat = Pattern.compile(regex);
        } else {
            pat = Pattern.compile(regex, flags);
        }
        Matcher mat = pat.matcher(str);
        return mat.replaceAll(ment);
    }
}

Related

  1. replaceAll(final String regex, final String replaceWith, final String subject)
  2. replaceAll(final String regex, final String text, final String replacement)
  3. replaceAll(Pattern p, String s, String r, Function cb)
  4. replaceAll(Pattern pattern, String string, String replacement)
  5. replaceAll(String original, String regexWhat, String with)
  6. replaceAll(String regex, String str, Map map)
  7. replaceAll(String regularExpression, String string, String newValue)
  8. replaceAll(String source, Pattern pattern, String replace)
  9. replaceAll(String str, String originalToken, String replacementToken)