Package java.util.regex

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


  private void collectQualifiedNames() {
    StringBuffer sb = new StringBuffer(text.length());
    int lastStart = 0;
    Matcher m = QUALIFIED_REFERENCE.matcher(text);
    m.region(lastImportLocation, text.length());
    while (m.find()) {
      sb.append(text.substring(lastStart, m.start(1)));
      lastStart = m.start(2);
      String name = m.group(2);
      String qualifier = trimLastDot(m.group(1));
View Full Code Here


             * (without parent for now) and parse the values for each column. Columns with empty
             * text are not parsed (the value is left to null).
             */
            final TreeTable.Node node = new DefaultTreeTable.Node(table);
            try {
                matcher.region(indexOfValue, endOfLine);
                for (int ci=0; ci<columns.length; ci++) {
                    final boolean found = matcher.find();
                    int endOfColumn = found ? matcher.start() : endOfLine;
                    indexOfValue   = CharSequences.skipLeadingWhitespaces (text, indexOfValue, endOfColumn);
                    int endOfValue = CharSequences.skipTrailingWhitespaces(text, indexOfValue, endOfColumn);
View Full Code Here

        ArrayList<Match> tryMatch(String s, int start, int end) {
            ArrayList<Match> alm = new ArrayList<Match>();
            if (isPattern()) {
                //System.out.println("Try pmatch pattern \""+pattern+"\" at "+start+"-"+end);
                Matcher m = pattern.matcher(s);
                m.region(start, end);
                while (m.find()) {
                    //System.out.println("Matched "+m.start()+"-"+m.end());
                    Match mtch = new Match(m.start(), m.end(), this);
                    if (bindings!=null) {
                        int gc = Math.min(m.groupCount(), bindings.length);
View Full Code Here

                }
            } else {
                for (Pattern p: beg) {
                    //System.out.println("Try match \""+p+"\" at "+start+"-"+end);
                    Matcher m = p.matcher(s);
                    m.region(start, end);
                    // Find it only once: PE: ... Other PE: problem!
                    // Andreea Bodnari: we actually want to find the section
                    // if it is present multiple times
                    while (m.find()) {
                        //System.out.println("Matched "+m.start()+"-"+m.end());
View Full Code Here

                // If port is the attribute, then comma will not be used as a
                // delimiter
                if (attrName.equalsIgnoreCase("port") || attrName.equalsIgnoreCase("expires")) {
                    int start = matcher.regionStart();
                    matcher = ATTR_PATTERN0.matcher(headerString);
                    matcher.region(start, headerString.length());
                    matcher.lookingAt();
                } else if (cookie.getVersion() == 1 && attrName.startsWith(COMMA_STR)) {
                    // If the last encountered token is comma, and the parsed
                    // attribute is not port, then this attribute/value pair
                    // ends.
View Full Code Here

    int startPos = m.start();
    // Find end of form
     p = Pattern.compile("</form>");
//    p = getPattern("util.formEnd");
    m = p.matcher(page);
    m.region(startPos, page.length());
    // Confirm send resource does not have "</form>"
    int endPos = page.length();
    if (m.find()) {   
      endPos = m.end();
    }
View Full Code Here

   
    // Find hidden fields
     p = Pattern.compile("<input +type=\"hidden\" +name=\"(.*?)\" +value=\"(.*?)\"");
//    p = getPattern("util.hiddenField");
    m = p.matcher(page);
    m.region(startPos, endPos);
    while (m.find()) {
      String name = m.group(1);
      String value = m.group(2);
      names.add(name);
      values.add(value);
View Full Code Here

            values.add(e.getValue());
           
            matchedDelimiter = false;
            if (m.group(2) != null || m.group(3) != null) {
                // Skip the last '"'.
                m.region(m.end() + 1, m.regionEnd());
            }
        }
       
        Object answer = Array.newInstance(componentType, values.size());
        for (int i = 0; i < Array.getLength(answer); i ++) {
View Full Code Here

            // TODO escape here.
            String region = m.group();

            if (m.group(3) != null || m.group(4) != null) {
                // Skip the last '"'.
                m.region(m.end() + 1, m.regionEnd());
            }
           
            switch (lastTokenType) {
            case ENTRY_DELIM:
                keyEditor.setAsText(region);
View Full Code Here

            answer.add(e.getValue());
           
            matchedDelimiter = false;
            if (m.group(2) != null || m.group(3) != null) {
                // Skip the last '"'.
                m.region(m.end() + 1, m.regionEnd());
            }
        }
       
        return answer;
    }
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.