Package java.util.regex

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


  public static String convertUrl(String source, Pattern pattern)
  {
    String result = source;

    Matcher  url_matcher = pattern.matcher(source);
    boolean found = url_matcher.find();
        if (found)
    {
      String visual_url = null;
      String actual_url = null;
      int last = 0;
View Full Code Here


          }
          sb.append("</a>");

          last = url_matcher.end(0);

          found = url_matcher.find();
        }
        while (found);

        sb.append(source.substring(last));
        result = sb.toString();
View Full Code Here

    }

    private static String replaceNumericEntities(String str, Pattern pattern, int base) {
        Matcher matcher = pattern.matcher(str);
        StringBuffer buf = new StringBuffer(str.length());
        for (; matcher.find(); matcher.appendReplacement(buf, Character.toString((char) Integer.parseInt(matcher.group(1), base))))
            ;
        matcher.appendTail(buf);
        return buf.toString();
    }
View Full Code Here

      Iterator<Pattern> iterator = map.keySet().iterator();
      while( iterator.hasNext() )
      {
         Pattern pattern = iterator.next();
         Matcher matcher = pattern.matcher( text );
         if( matcher.find( 0 ) )
         {
            return map.get( pattern );
         }
      }
View Full Code Here

      Pattern combinedSearchPattern = fileLinkDefinitionLord.getSearchPattern();
      Matcher matcher = combinedSearchPattern.matcher( text );

      int index = 0;

      boolean foundAMatch = matcher.find( index );
      while( foundAMatch )
      {
         // Retrieve matching string
         String matchedText = matcher.group();
View Full Code Here

         }

         index = nextStarting + 1;
         if( index < text.length() )
         {
            foundAMatch = matcher.find( index );
         }
         else
         {
            foundAMatch = false; //don't continue searching if we've found the end
         }
View Full Code Here

    }

    private String uriDecode(String path) {
        StringBuffer builder = new StringBuffer();
        Matcher matcher = ENCODED_URI.matcher(path);
        while (matcher.find()) {
            String val = matcher.group(1);
            matcher.appendReplacement(builder, String.valueOf((char) (Integer.parseInt(val, 16))));
        }
        matcher.appendTail(builder);
        return builder.toString();
View Full Code Here

    private static Pattern getPatternForName(String name) {
        Pattern boundaryPattern = Pattern.compile("((^|\\p{Punct})\\p{javaLowerCase}+)|(\\p{javaUpperCase}\\p{javaLowerCase}*)");
        Matcher matcher = boundaryPattern.matcher(name);
        int pos = 0;
        StringBuilder builder = new StringBuilder();
        while (matcher.find()) {
            String prefix = name.substring(pos, matcher.start());
            if (prefix.length() > 0) {
                builder.append(Pattern.quote(prefix));
            }
            builder.append(Pattern.quote(matcher.group()));
View Full Code Here

          MultipleDocumentInterface.SIDEBAR_SECTION_BURN_INFO.equals(tabID)) {
        Pattern pattern = Pattern.compile("http.*//[^/]+/([^.]+)");
        Matcher matcher = pattern.matcher(sourceRef);
       
        String sourceRef2;
        if (matcher.find()) {
          sourceRef2 = matcher.group(1);
        } else {
          sourceRef2 = sourceRef;
        }
       
View Full Code Here

    }

    String url = dlInfo.getDownloadURL();
    try {
      Matcher m = hashPattern.matcher(url);
      if (m.find()) {
        String hash = m.group(1);
        GlobalManager gm = core.getGlobalManager();
        final DownloadManager dm = gm.getDownloadManager(new HashWrapper(
            Base32.decode(hash)));
        if (dm != 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.