Package java.util.regex

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


        methodName=methodName.startsWith("is")? methodName.substring(2) : methodName;
        // Pattern p=Pattern.compile("[A-Z]+");
        Matcher m=METHOD_NAME_TO_ATTR_NAME_PATTERN.matcher(methodName);
        StringBuffer sb=new StringBuffer();
        while(m.find()) {
            int start=m.start(), end=m.end();
            String str=methodName.substring(start, end).toLowerCase();
            if(str.length() > 1) {
                String tmp1=str.substring(0, str.length() -1);
                String tmp2=str.substring(str.length() -1);
                str=tmp1 + "_" + tmp2;
View Full Code Here


              String fragment = document.getText(it.getStartOffset(), it
                  .getEndOffset()
                  - it.getStartOffset());
              Matcher matcher = pattern.matcher(fragment);
              while (matcher.find()) {
                highlighter.addHighlight(it.getStartOffset() + matcher.start(),
                    it.getStartOffset() + matcher.end(), painter);
              }
            } catch (BadLocationException ex) {
            }
          }
View Full Code Here

        // check if the actual string satisfies the specification
        if (matcher.find()) {
            // a match has been found, but we need to check that the whole event string
            // matches, and not just a substring
            if (!(matcher.start() == 0 && matcher.end() == eventString.length())) {
                // match on full eventString not found
                System.err
                                .println("event string invalid (proper substring matched): event string = "
                                                + eventString
                                                + ", specification = "
View Full Code Here

                                .println("event string invalid (proper substring matched): event string = "
                                                + eventString
                                                + ", specification = "
                                                + spec
                                                + "matcher.start() "
                                                + matcher.start()
                                                + " matcher.end() " + matcher.end());
                return false;
            }
        } else {
            return false;
View Full Code Here

    // accept raw hash of 32 base-32 chars, with garbage around it
    if (accept_magnets && guess) {
      Pattern pattern = Pattern.compile("[^a-zA-Z2-7][a-zA-Z2-7]{32}[^a-zA-Z2-7]");
      Matcher matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 33);
        return "magnet:?xt=urn:btih:" + hash;
      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
View Full Code Here

    // accept raw hash of 32 base-32 chars, with garbage around it
    if (accept_magnets && guess) {
      Pattern pattern = Pattern.compile("[^a-zA-Z2-7][a-zA-Z2-7]{32}[^a-zA-Z2-7]");
      Matcher matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 33);
        return "magnet:?xt=urn:btih:" + hash;
      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
View Full Code Here

      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 41);
        // convert from HEX to raw bytes
        byte[] infohash = ByteFormatter.decodeString(hash.toUpperCase());
        // convert to BASE32
        return "magnet:?xt=urn:btih:" + Base32.encode(infohash);
      }
View Full Code Here

      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 41);
        // convert from HEX to raw bytes
        byte[] infohash = ByteFormatter.decodeString(hash.toUpperCase());
        // convert to BASE32
        return "magnet:?xt=urn:btih:" + Base32.encode(infohash);
      }
View Full Code Here

    if (true) {
      text = "!" + text + "!";
      pattern = Pattern.compile("[^a-zA-Z2-7][a-zA-Z2-7]{32}[^a-zA-Z2-7]");
      matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 33);
        return "magnet:?xt=urn:btih:" + hash;
      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
View Full Code Here

    if (true) {
      text = "!" + text + "!";
      pattern = Pattern.compile("[^a-zA-Z2-7][a-zA-Z2-7]{32}[^a-zA-Z2-7]");
      matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 33);
        return "magnet:?xt=urn:btih:" + hash;
      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
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.