Class XRegexUtils


  • public final class XRegexUtils
    extends Object
    • Constructor Detail

      • XRegexUtils

        public XRegexUtils()
    • Method Detail

      • replaceAll

        public static String replaceAll​(String value,
                                        String search,
                                        BiFunction<String,​Integer,​String> replacer)
        Replace all occurrences of a search string in a string with a replacement string computed by a function.
        Parameters:
        value - The string to search in.
        search - The string to search for.
        replacer - The function to compute the replacement string.
        Returns:
        The resulting string.
      • replaceAllPattern

        public static String replaceAllPattern​(String value,
                                               String searchPattern,
                                               BiFunction<MatchResult,​Integer,​String> replacer)
        Replace all occurrences matching the given pattern in a string with a replacement string computed by a function.
        Parameters:
        value - The string to search in.
        searchPattern - The pattern to search for.
        replacer - The function to compute the replacement string.
        Returns:
        The resulting string.
      • replaceAllPattern

        public static String replaceAllPattern​(String value,
                                               Pattern search,
                                               BiFunction<MatchResult,​Integer,​String> replacer)
        Replace all occurrences matching the given pattern in a string with a replacement string computed by a function.
        Parameters:
        value - The string to search in.
        search - The pattern to search for.
        replacer - The function to compute the replacement string.
        Returns:
        The resulting string.