Here you can find the source of replaceFirst(String str, String regex, String replacement, int patternFlag)
Parameter | Description |
---|---|
patternFlag | java.util.regex.Pattern |
public static String replaceFirst(String str, String regex, String replacement, int patternFlag)
//package com.java2s; //License from project: Apache License import java.util.regex.Pattern; public class Main { /**//ww w . ja v a2 s.c om * @param patternFlag {@link java.util.regex.Pattern} * **/ public static String replaceFirst(String str, String regex, String replacement, int patternFlag) { return Pattern.compile(regex, patternFlag).matcher(str).replaceFirst(replacement); } }