Code example for Matcher

Methods: groupmatchesreplaceFirst

0
     * @throws NumberFormatException 
     *             if the current site tag is not correctly formatted 
     */ 
    public static String bumpSiteTag(CharSequence siteTag) {
        Matcher m = SITE_TAG_PATTERN.matcher(siteTag);
        if (m.matches()) {
            return m.replaceFirst(String.format("$1:%d", Integer.parseInt(m.group(2)) + 1));
        } else if (siteTag.length() > 0) {
            return String.format("%s:1", siteTag);
        } 
        return siteTag.toString();
    } 
} 
Experience pair programming with AI  Get Codota for Java