Package java.util.regex

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


        Matcher m = keyword.matcher(p);
        ArrayList rslt = new ArrayList();
        int pos = 0;
//        rslt.add("");
        while (m.find()) {
            if (m.start()>pos || pos==0) {
                rslt.add(p.substring(pos,m.start()));
            }
            rslt.add(p.substring(m.start(),m.end()));
            pos = m.end();
        }
View Full Code Here


        ArrayList rslt = new ArrayList();
        int pos = 0;
//        rslt.add("");
        while (m.find()) {
            if (m.start()>pos || pos==0) {
                rslt.add(p.substring(pos,m.start()));
            }
            rslt.add(p.substring(m.start(),m.end()));
            pos = m.end();
        }
        if (pos < p.length())
View Full Code Here

//        rslt.add("");
        while (m.find()) {
            if (m.start()>pos || pos==0) {
                rslt.add(p.substring(pos,m.start()));
            }
            rslt.add(p.substring(m.start(),m.end()));
            pos = m.end();
        }
        if (pos < p.length())
            rslt.add(p.substring(pos));
       
View Full Code Here

    private int classify(String string) {
        Matcher m = keyword.matcher(string);
        if (!m.matches())
            return OTHER;
        for (int i = 1; i <= m.groupCount(); i++)
            if (m.start(i) != -1)
                return i;
        throw new IllegalStateException(
                "IRI code internal error: no group matched.");
    }
View Full Code Here

      if ( line.charAt( 0 ) == '#' ) continue;
      matcher.reset( line );
      l = 0;
      start = 0;
      while( matcher.find() && l <= h ) {
        printStream[ l ].println( line.subSequence( start, matcher.start() ) );
        start = matcher.end();
        l++;
      }
    }
   
View Full Code Here

        int iEarliest = -1;
        String s = filter.regex ? filter.text : "\\Q" + filter.text + "\\E";
        Pattern pattern = Pattern.compile(s, Pattern.CASE_INSENSITIVE);
        for (int i = 0; i < cells.length; i++) {
          Matcher m = pattern.matcher(cells[i].getText());
          if (m.find() && (m.start() < iEarliest || iEarliest == -1)) {
            iEarliest = m.start();
            index = i;
          }
        }
View Full Code Here

        String s = filter.regex ? filter.text : "\\Q" + filter.text + "\\E";
        Pattern pattern = Pattern.compile(s, Pattern.CASE_INSENSITIVE);
        for (int i = 0; i < cells.length; i++) {
          Matcher m = pattern.matcher(cells[i].getText());
          if (m.find() && (m.start() < iEarliest || iEarliest == -1)) {
            iEarliest = m.start();
            index = i;
          }
        }

        if (index < 0)
View Full Code Here

          else
          {
            visual_url = actual_url;
          }

          sb.append(source.substring(last, url_matcher.start(0)));
          sb.append("<a href=\"");
          if (actual_url.startsWith("www."))
          {
            actual_url = "http://"+actual_url;
          }
View Full Code Here

      {
         // Retrieve matching string
         String matchedText = matcher.group();

         // Retrieve indices of matching string
         int start = matcher.start();
         int end = matcher.end();

         int nextStarting = start;

         //now that we have a match, we have to find the one FileLinkDefinition that actually matches so it
View Full Code Here

        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()));
            builder.append("[\\p{javaLowerCase}\\p{Digit}]*");
 
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.