Package java.util.regex

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


        }

        for (FileNameMapping mapping : fileNameMappings) {
            Matcher matcher = mapping.getNamePattern().matcher(resourcePath);
            if (matcher.find()) {
                return matcher.replaceAll(mapping.getValue());
            }
        }

        return resourcePath;
    }
View Full Code Here


        if (string == null) {
            return null;
        }

        Matcher matcher = BACKSLASH.matcher(string);
        return matcher.find() ? matcher.replaceAll("\\/") : string;
    }

    /**
     * Returns package name for the Java class as a path separated with forward slash
     * ("/"). Method is used to lookup resources that are located in package
View Full Code Here

            return "";
        }

        Matcher matcher = DOT.matcher(className);
        if (matcher.find()) {
            String path = matcher.replaceAll("\\/");
            return path.substring(0, path.lastIndexOf("/"));
        }
        else {
            return "";
        }
View Full Code Here

    MultiTypeType arrayType = new MultiTypeType();
    Matcher m = ARRAY_TYPE_PATTERN.matcher(type);
    if (m.find()) {
      arrayType
          .addType(getArrayType(m.group(), currentNamespace, offset));
      type = m.replaceAll("");
    }
    String[] typeNames = type.split(",");
    for (String name : typeNames) {
      if (!"".equals(name)) {
View Full Code Here

            String replacement = rar.getReplacement();

            // Return if we find a match.
            Matcher matcher = Pattern.compile(rule, Pattern.CASE_INSENSITIVE).matcher(word);
            if (matcher.find()) {
                return matcher.replaceAll(replacement);
            }
        }
        return word;
    }
View Full Code Here

                final Pattern pattern = entry.getKey();
                final Matcher m = pattern.matcher(path);

                if (m.matches()) {
                    for (final String value : entry.getValue()) {
                        final String flushPath = m.replaceAll(value);
   
                        log.debug("Requesting hierarchical flush of associated path: {} ~> {}", path,
                                flushPath);
                        dispatcherFlusher.flush(resourceResolver, flushActionType, false,
                                HIERARCHICAL_FILTER,
View Full Code Here

                final Pattern pattern = entry.getKey();
                final Matcher m = pattern.matcher(path);

                if (m.matches()) {
                    for (final String value : entry.getValue()) {
                        final String flushPath = m.replaceAll(value);
   
                        log.debug("Requesting ResourceOnly flush of associated path: {} ~> {}", path, entry.getValue());
                        dispatcherFlusher.flush(resourceResolver, flushActionType, false,
                                RESOURCE_ONLY_FILTER,
                                flushPath);
View Full Code Here

    try {
      return Double.parseDouble(str);
    } catch (Throwable e) {
      Matcher m = p.matcher(str);
      String rtn = m.replaceAll("").trim();
      if (rtn.isEmpty()) {
        return 0d;
      }
      return Double.parseDouble(rtn);
    }
View Full Code Here

     */
    static String replaceSubstitution(String base, Pattern from, String to,
                                      boolean repeat) {
      Matcher match = from.matcher(base);
      if (repeat) {
        return match.replaceAll(to);
      } else {
        return match.replaceFirst(to);
      }
    }

View Full Code Here

        if (ruleExpression != null) {
            Pattern p = compile(defaultIfEmpty(expression, "^.*$").trim());
            Matcher m = p.matcher(definition.getName());

            if (m.matches()) {
                return transform(m.replaceAll(ruleExpression), ruleTransformType);
            }

            m = p.matcher(definition.getQualifiedName());

            if (m.matches()) {
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.