Package java.util.regex

Examples of java.util.regex.Matcher.replaceAll()


                while (match.find()) {
                    String tmp = match.group(0);
                    Matcher matchW = paW.matcher(tmp);
                    if(matchW.find()){       //look for width
                      if(Integer.parseInt(matchW.group(3).trim())>maxw){
                         tmp=matchW.replaceAll("width=\""+maxw+"\"");
                          //we now remove the height tag
                          Matcher matchH = paH.matcher(tmp);
                          if(matchH.find()){
                              tmp = matchH.replaceAll("");
                          }
View Full Code Here


                      if(Integer.parseInt(matchW.group(3).trim())>maxw){
                         tmp=matchW.replaceAll("width=\""+maxw+"\"");
                          //we now remove the height tag
                          Matcher matchH = paH.matcher(tmp);
                          if(matchH.find()){
                              tmp = matchH.replaceAll("");
                          }
                          //we now replace the original tag with the new tag
                          match.appendReplacement(sb,tmp);
                      }
View Full Code Here

        }

        Matcher matcher = BLOCK_CATEGORY_RE.matcher(metricName);
        if (matcher.find()) {
           // Only process per-block-category metrics
          String metricNoBlockCategory = matcher.replaceAll("");

          putLong(allBlockCategoryDeltas, metricNoBlockCategory,
              getLong(allBlockCategoryDeltas, metricNoBlockCategory) + delta);
        }
      }
View Full Code Here

        Matcher m = date.matcher(pattern);
        String logBackPattern = pattern;

        if (m.matches()) {
            // If legacy pattern then transform the date format
            logBackPattern = m.replaceAll("%d'{'$1'}'");
        }

        boolean legacyPattern = false;
        for (String marker : LEGACY_MARKERS) {
            if (logBackPattern.contains(marker)) {
View Full Code Here

    public static String fixUriPath(final String uriPath) {
        for (int i = 0; i < URL_WITH_PORT_MATCH.length; i++) {
            final Matcher m = URL_WITH_PORT_MATCH[i].matcher(uriPath);
            if (m.find()) {
                return m.replaceAll(URL_WITH_PORT_REPLACEMENT[i]);
            }
        }

        return uriPath;
    }
View Full Code Here

     */
    public static String toURI(final String uriPath) {
        for (int i = 0; i < PATH_TO_URL_MATCH.length; i++) {
            final Matcher m = PATH_TO_URL_MATCH[i].matcher(uriPath);
            if (m.find()) {
                return m.replaceAll(PATH_TO_URL_REPLACEMENT[i]);
            }
        }

        return null;
    }
View Full Code Here

      {
        result = m1.replaceAll("($1*)");
      }
      else if (m2.find())
      {
        result = m2.replaceAll("$1*");
      }
    }

    return result;
  }
View Full Code Here

    public static String normalizeWhitespace(@Nonnull String source) {
        source = normalizeNewlines(source, "\n");

        Pattern pattern = Pattern.compile("(\n[ \t]*)+");
        Matcher matcher = pattern.matcher(source);
        return matcher.replaceAll("\n");
    }
}
View Full Code Here

    }
   
   
    private static String replace(String string, Pattern pattern, String replacement) {
        Matcher m = pattern.matcher(string);
        return m.replaceAll(replacement);
    }
   
}
View Full Code Here

                    Matcher matcher = pattern.matcher(line);
                    if (matcher.matches()) {
                        if (outFile == null) {
                            outFile = new File(pkg, "LocaleTest.java");
                        }
                        String exp = matcher.replaceAll("$1");
                        pkgBuffer.append("        ").append(exp).append(");\n");
                    }
                }
            }
            if (outFile != null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.