Package org.apache.regexp

Examples of org.apache.regexp.RE.match()


     *
     * @return Path of the URI.
     */
    public static String getPath(String uri) {
        RE re = new RE(uripattern);
        if (re.match(uri)) {
            return re.getParen(5);
        } else {
            throw new IllegalArgumentException("'" + uri +
                                               "' is not a correct URI");
        }
View Full Code Here


     *
     * @return Path of the URI.
     */
    public static String getPathWithoutAuthority(String uri) {
        RE re = new RE(uripattern);
        if (re.match(uri)) {
            return re.getParen(4) + re.getParen(5);
        } else {
            throw new IllegalArgumentException("'" + uri +
                                               "' is not a correct URI");
        }
View Full Code Here

     *
     * @return Query of the URI.
     */
    public static String getQuery(String uri) {
        RE re = new RE(uripattern);
        if (re.match(uri)) {
            return re.getParen(7);
        } else {
            throw new IllegalArgumentException("'" + uri +
                                               "' is not a correct URI");
        }
View Full Code Here

     *
     * @return Fragment of the URI.
     */
    public static String getFragment(String uri) {
        RE re = new RE(uripattern);
        if (re.match(uri)) {
            return re.getParen(9);
        } else {
            throw new IllegalArgumentException("'" + uri +
                                               "' is not a correct URI");
        }
View Full Code Here

        is.unread(buffer, 0, len);
       
        // Interpret them as an ASCII string
        String str = new String(buffer, 0, len, "ASCII");
        RE re = new RE(encodingRE);
        if (re.match(str)) {
            return re.getParen(1);
        }
        return null;
    }
View Full Code Here

        if (reProgram == NO_REGEXP) {
            newAttrValue = createTransformedLink(oldAttrValue);
        } else {
            // must be instanceof REProgram
            RE r = new RE((REProgram) reProgram);
            if (r.match(oldAttrValue)) {
                StringBuffer bufOut = new StringBuffer(oldAttrValue);
                int offset = 0;
                String link = null;
                String newLink = null;
                boolean modified = false;
View Full Code Here

     * @return true if the specified input matches the regular expression regex.
     */
    public static boolean matches(String regex, String input)
        throws RESyntaxException {
        RE re = REUtil.createRE(regex);
        return re.match(input);
    }

    public static void assertMatches(String regex, String input) {
        try {
            if (!(matches(regex, input)))
View Full Code Here

        if (match == null) {
            return null;
        }

        if (re.match(match)) {
            /* Handle parenthesised subexpressions. XXX: could be faster if we count
             * parens *outside* the generated code.
             * Note: *ONE* based, not zero, zero contains complete match
             */
            int parenCount = re.getParenCount();
View Full Code Here

        if (reProgram == NO_REGEXP) {
            newAttrValue = createTransformedLink(oldAttrValue);
        } else {
            // must be instanceof REProgram
            RE r = new RE((REProgram) reProgram);
            if (r.match(oldAttrValue)) {
                StringBuffer bufOut = new StringBuffer(oldAttrValue);
                int offset = 0;
                String link = null;
                String newLink = null;
                boolean modified = false;
View Full Code Here

     * @return Scheme of the URI.
     */
    public static String getScheme(String uri) {
        RE re = new RE(uripattern);

        if (re.match(uri)) {
            return re.getParen(2);
        } else {
            throw new IllegalArgumentException("'"+uri+
                                               "' is not a correct URI");
        }
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.