Package java.util.regex

Examples of java.util.regex.MatchResult.group()


    page.render(htmlWriter, request);
    Pattern pathFinder = Pattern.compile("(href|src)=\"([^\"]*)\"");
    Matcher matcher = pathFinder.matcher(writer.toString());
    while (matcher.find()) {
      MatchResult result = matcher.toMatchResult();
      String[] components = result.group(2).trim().split("/");
      ConsolePageTest.assertEquals("Missing initial /","", components[0]);
      ConsolePageTest.assertEquals(jstd, components[1]);
      ConsolePageTest.assertFalse("Second component should not be the prefix.",
        jstd.equals(components[2]));
    }
View Full Code Here


                        encoder.textToken(source.next(), TokenType.error);
                    }
                    break;
                case string:
                    if ((m = source.scan(STRING_CONTENT_PATTERN.get(string_delimiter))) != null) {
                        encoder.textToken(m.group(), TokenType.content);
                    } else if ((m = source.scan(END_STRING)) != null) {
                        encoder.textToken(m.group(), TokenType.delimiter);
                        encoder.endGroup(TokenType.string);
                        state = State.initial;
                        string_delimiter = null;
View Full Code Here

                    break;
                case string:
                    if ((m = source.scan(STRING_CONTENT_PATTERN.get(string_delimiter))) != null) {
                        encoder.textToken(m.group(), TokenType.content);
                    } else if ((m = source.scan(END_STRING)) != null) {
                        encoder.textToken(m.group(), TokenType.delimiter);
                        encoder.endGroup(TokenType.string);
                        state = State.initial;
                        string_delimiter = null;
                    } else if (state == State.string && (m = source.scan(STRING_CONTENT)) != null) {
                        if ("'".equals(string_delimiter) && !("\\\\".equals(m.group()) || "\\'".equals(m.group()))) {
View Full Code Here

                        encoder.textToken(m.group(), TokenType.delimiter);
                        encoder.endGroup(TokenType.string);
                        state = State.initial;
                        string_delimiter = null;
                    } else if (state == State.string && (m = source.scan(STRING_CONTENT)) != null) {
                        if ("'".equals(string_delimiter) && !("\\\\".equals(m.group()) || "\\'".equals(m.group()))) {
                            encoder.textToken(m.group(), TokenType.content);
                        } else {
                            encoder.textToken(m.group(), TokenType.char_);
                        }
                    } else if ((m = source.scan(STRING_CONTENT_2)) != null) {
View Full Code Here

                        encoder.textToken(m.group(), TokenType.delimiter);
                        encoder.endGroup(TokenType.string);
                        state = State.initial;
                        string_delimiter = null;
                    } else if (state == State.string && (m = source.scan(STRING_CONTENT)) != null) {
                        if ("'".equals(string_delimiter) && !("\\\\".equals(m.group()) || "\\'".equals(m.group()))) {
                            encoder.textToken(m.group(), TokenType.content);
                        } else {
                            encoder.textToken(m.group(), TokenType.char_);
                        }
                    } else if ((m = source.scan(STRING_CONTENT_2)) != null) {
View Full Code Here

                        encoder.endGroup(TokenType.string);
                        state = State.initial;
                        string_delimiter = null;
                    } else if (state == State.string && (m = source.scan(STRING_CONTENT)) != null) {
                        if ("'".equals(string_delimiter) && !("\\\\".equals(m.group()) || "\\'".equals(m.group()))) {
                            encoder.textToken(m.group(), TokenType.content);
                        } else {
                            encoder.textToken(m.group(), TokenType.char_);
                        }
                    } else if ((m = source.scan(STRING_CONTENT_2)) != null) {
                        encoder.textToken(m.group(), TokenType.content);
View Full Code Here

                        string_delimiter = null;
                    } else if (state == State.string && (m = source.scan(STRING_CONTENT)) != null) {
                        if ("'".equals(string_delimiter) && !("\\\\".equals(m.group()) || "\\'".equals(m.group()))) {
                            encoder.textToken(m.group(), TokenType.content);
                        } else {
                            encoder.textToken(m.group(), TokenType.char_);
                        }
                    } else if ((m = source.scan(STRING_CONTENT_2)) != null) {
                        encoder.textToken(m.group(), TokenType.content);
                    } else if ((m = source.scan(END_GROUP)) != null) {
                        encoder.endGroup(TokenType.string);
View Full Code Here

                            encoder.textToken(m.group(), TokenType.content);
                        } else {
                            encoder.textToken(m.group(), TokenType.char_);
                        }
                    } else if ((m = source.scan(STRING_CONTENT_2)) != null) {
                        encoder.textToken(m.group(), TokenType.content);
                    } else if ((m = source.scan(END_GROUP)) != null) {
                        encoder.endGroup(TokenType.string);
                        state = State.initial;
                        if (!m.group().isEmpty()) {
                            encoder.textToken(m.group(), TokenType.error);
View Full Code Here

                    } else if ((m = source.scan(STRING_CONTENT_2)) != null) {
                        encoder.textToken(m.group(), TokenType.content);
                    } else if ((m = source.scan(END_GROUP)) != null) {
                        encoder.endGroup(TokenType.string);
                        state = State.initial;
                        if (!m.group().isEmpty()) {
                            encoder.textToken(m.group(), TokenType.error);
                        }
                    } else {
                        throw new RuntimeException("else case \" reached; " + source.peek(1) + " in " + getClass());
                    }
View Full Code Here

                    break;
                default:
                    throw new RuntimeException("unknown state " + state);
            }
            if (m != null) {
                last_token_dot = (".".equals(m.group()));
            }
        }
        if (state == State.string) {
            encoder.endGroup(TokenType.string);
        }
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.