Package java.util.regex

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


            m.appendReplacement(result, init + "/proxy.html?url=http://" + proxyurl.getHost() + url);

        } else {
          // relative path of form href="relative/path"
          MultiProtocolURI target = new MultiProtocolURI(proxyurl.getHost() + directory + "/" + url);
            m.appendReplacement(result, init + "/proxy.html?url=" + target.toString());

        }
      }
      m.appendTail(result);
View Full Code Here


  private String uppercaseRomanLetters(String text) {
    // first replace underscores with spaces to use word separator
    Matcher ma = ROMAN_LETTER_PATTERN.matcher(text.replaceAll("_", " "));
    StringBuffer out = new StringBuffer();
    while (ma.find()) {
      ma.appendReplacement(out, ma.group().toUpperCase());
    }
    ma.appendTail(out);
    return out.toString();
  }
}
View Full Code Here

      while (matcher.find())
      {
         String replacement = params.get(i++);
         // double encode slashes, so that slashes stay where they are
         replacement = replacement.replace("\\", "\\\\");
         matcher.appendReplacement(newSegment, replacement);
      }
      matcher.appendTail(newSegment);
      segment = newSegment.toString();
      return segment;
   }
View Full Code Here

      {
         decoder.reset();
         String decoded = decodeBytes(matcher.group(1), decoder);
         decoded = decoded.replace("\\", "\\\\");
         decoded = decoded.replace("$", "\\$");
         matcher.appendReplacement(buf, decoded);
      }
      matcher.appendTail(buf);
      return buf.toString();
   }
View Full Code Here

   {
      Matcher matcher = nonCodes.matcher(string);
      StringBuffer buf = new StringBuffer();
      while (matcher.find())
      {
         matcher.appendReplacement(buf, "%25$1");
      }
      matcher.appendTail(buf);
      return buf.toString();
   }
View Full Code Here

      {
         foundParam = true;
         String group = matcher.group();
         // Regular expressions can have '{' and '}' characters.  Recover earlier replacement
         params.add(PathHelper.recoverEnclosedCurlyBraces(group));
         matcher.appendReplacement(newSegment, "_resteasy_uri_parameter");
      }
      matcher.appendTail(newSegment);
      return foundParam;
   }
View Full Code Here

                String group = matcher.group(2);
                StringBuilder spaces = new StringBuilder();
                for (int i = 0; i < group.length(); i++) {
                    spaces.append("&#160;");
                }
                matcher.appendReplacement(temp, "$1"+spaces.toString()+"$3");
            }
            matcher.appendTail(temp);
            result = temp.toString();
        }
        if (convertNewlines) {
View Full Code Here

        Pattern regex = Pattern.compile( "(" + Pattern.quote("[") + Pattern.quote("[") + "link" +Pattern.quote("]") + Pattern.quote("]") + ")" );
        Matcher matcher = regex.matcher(getLink());

        while (matcher.find()) {
            matcher.appendReplacement(realLink, substitute);
        }
        matcher.appendTail(realLink);
        return realLink.toString();
    }
}
View Full Code Here

            // Find the node by PK
            WikiFile file = wikiNodeDAO.findWikiFile(Long.valueOf(fileId));

            // Node is in current area, just use its name
            if (file != null && file.getAreaNumber().equals(currentAreaNumber)) {
                matcher.appendReplacement(replacedWikiText, "[$1=>" + file.getName() + fragment +"]");

            // Node is in different area, prepend the area name
            } else if (file != null && !file.getAreaNumber().equals(currentAreaNumber)) {
                WikiDirectory area = wikiNodeDAO.findArea(file.getAreaNumber());
                matcher.appendReplacement(replacedWikiText, "[$1=>" + area.getName() + "|" + file.getName() + fragment +"]");
View Full Code Here

                matcher.appendReplacement(replacedWikiText, "[$1=>" + file.getName() + fragment +"]");

            // Node is in different area, prepend the area name
            } else if (file != null && !file.getAreaNumber().equals(currentAreaNumber)) {
                WikiDirectory area = wikiNodeDAO.findArea(file.getAreaNumber());
                matcher.appendReplacement(replacedWikiText, "[$1=>" + area.getName() + "|" + file.getName() + fragment +"]");

            // Couldn't find it anymore, its a broken link
            } else {
                matcher.appendReplacement(replacedWikiText, "[$1=>" + BROKENLINK_DESCRIPTION + "]");
            }
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.