common/src/main/java/com/streamsets/pipeline/lib/parser/shaded/com/google/code/regexp/Pattern.java
private StringBuilder replaceGroupNameWithIndex(StringBuilder input, java.util.regex.Pattern pattern, String prefix) {
        java.util.regex.Matcher m = pattern.matcher(input);
        while (m.find()) {
            if (isEscapedChar(input.toString(), m.start())) {
                continue;
            }

            int index = indexOf(m.group(INDEX_GROUP_NAME));
            if (index >= 0) {
                index++;
            } else {
                throw new PatternSyntaxException("unknown group name", input.toString(), m.start(INDEX_GROUP_NAME));
            }

            // since we're replacing the original string being matched,
            // we have to reset the matcher so that it searches the new
            // string
            input.replace(m.start(), m.end(), prefix + index);
            m.reset(input);
        }
        return input;
    }
private StringBuilder replaceGroupNameWithIndex(StringBuilder input, java.util.regex.Pattern pattern, String prefix) {
        java.util.regex.Matcher m = pattern.matcher(input);
        while (m.find()) {
            if (isEscapedChar(input.toString(), m.start())) {
                continue;
            }

            int index = indexOf(m.group(INDEX_GROUP_NAME));
            if (index >= 0) {
                index++;
            } else {
                throw new PatternSyntaxException("unknown group name", input.toString(), m.start(INDEX_GROUP_NAME));
            }

            // since we're replacing the original string being matched,
            // we have to reset the matcher so that it searches the new
            // string
            input.replace(m.start(), m.end(), prefix + index);
            m.reset(input);
        }
        return input;
    }
private StringBuilder replaceGroupNameWithIndex ( StringBuilder input , java . util . regex . Pattern pattern , String prefix ) { java . util . regex . Matcher m = pattern . matcher ( input ) ; while ( m . find ( ) ) { if ( isEscapedChar ( input . toString ( ) , m . start ( ) ) ) { continue ; } int index = indexOf ( m . group ( INDEX_GROUP_NAME ) ) ; if ( index >= 0 ) { index ++ ; } else { throw new PatternSyntaxException ( "unknown group name" , input . toString ( ) , m . start ( INDEX_GROUP_NAME ) ) ; } // since we're replacing the original string being matched, // we have to reset the matcher so that it searches the new // string input . replace ( m . start ( ) , m . end ( ) , prefix + index ) ; m . reset ( input ) ; } return input ; }
Replaces referenced group names with the reference to the corresponding group
index (e.g., <b><code>\k&lt;named></code></b>} to <b><code>\k2</code></b>};
<b><code>${named}</code></b> to <b><code>$2</code></b>}).
This assumes the group names have already been parsed from the pattern.

@param input the string to evaluate
@param pattern the pattern that matches the string to be replaced
@param prefix string to prefix to the replacement (e.g., "$" or "\\")
@return the modified string (original instance of {@code input})
@throws PatternSyntaxException group name was not found
Replaces referenced group names with the reference to the corresponding group index ( e . g . <b > <code > \ k&lt ; named > < / code > < / b > } to <b > <code > \ k2< / code > < / b > } ; <b > <code > $ { named } < / code > < / b > to <b > <code > $2< / code > < / b > } ) . This assumes the group names have already been parsed from the pattern .