Package org.apache.regexp

Examples of org.apache.regexp.RE


        protected void findStringPattern() {
            AsciiArtCoordinate aacStart = new AsciiArtCoordinate(this.asciiArtPad);
            aacStart.setTransXY(0, 3 * asciiArtPad.getYGrid() / 4);
            // string
            try {
                final RE reString = new RE(STRING_PREFIX_GROUP + STRING_SUFFIX_GROUP + "*");
                for (int r = 0; r < aa.getH(); r++) {
                    String row = aa.getRow(r);
                    int startIndex = 0;
                    while (reString.match(row, startIndex)) {
                        String s = reString.getParen(0);
                        int mStart = reString.getParenStart(0);
                        int mEnd = reString.getParenEnd(0);

                        aacStart.setXY(mStart, r);
                        AsciiArtString aas = new AsciiArtString(aacStart, s);
                        this.asciiArtPad.add(aas);

View Full Code Here


            this.getLogger().debug("depth: " + this.depth);
            this.getLogger().debug("sort: " + this.sort);
            this.getLogger().debug("reverse: " + this.reverse);
        }
        try {
            this.rootRE = (rePattern == null)?null:new RE(rePattern);

            rePattern = par.getParameter("include", null);
            this.includeRE = (rePattern == null)?null:new RE(rePattern);

            rePattern = par.getParameter("exclude", null);
            this.excludeRE = (rePattern == null)?null:new RE(rePattern);

            if (this.getLogger().isDebugEnabled()) {
                this.getLogger().debug("root pattern: " + rePattern);
                this.getLogger().debug("include pattern: " + rePattern);
                this.getLogger().debug("exclude pattern: " + rePattern);
View Full Code Here

                String pattern = children[i].getValue();
                try {
                    Tokenizer t = new Tokenizer(pattern, ", ");
                    while (t.hasMoreTokens()) {
                        String tokenized_pattern = t.nextToken();
                        this.includeCrawlingURL.add(new RE(tokenized_pattern));
                    }
                } catch (RESyntaxException rese) {
                    getLogger().error("Cannot create including regular-expression for " +
                            pattern, rese);
                }
            }
        }

        children = configuration.getChildren(EXCLUDE_CONFIG);
        if (children.length > 0) {
            excludeCrawlingURL = new HashSet();
            for (int i = 0; i < children.length; i++) {
                String pattern = children[i].getValue();
                try {
                    Tokenizer t = new Tokenizer(pattern, ", ");
                    while (t.hasMoreTokens()) {
                        String tokenized_pattern = t.nextToken();
                        this.excludeCrawlingURL.add(new RE(tokenized_pattern));
                    }
                } catch (RESyntaxException rese) {
                    getLogger().error("Cannot create excluding regular-expression for " +
                            pattern, rese);
                }
View Full Code Here

        };

        for (int i = 0; i < EXCLUDE_FROM_CRAWLING_DEFAULT.length; i++) {
            String pattern = EXCLUDE_FROM_CRAWLING_DEFAULT[i];
            try {
                excludeCrawlingURL.add(new RE(pattern));
            } catch (RESyntaxException rese) {
                getLogger().error("Cannot create excluding regular-expression for " +
                        pattern, rese);
            }
        }
View Full Code Here

        }

        final String s = url.toString();
        Iterator i = excludeCrawlingURL.iterator();
        while (i.hasNext()) {
            RE pattern = (RE) i.next();
            if (pattern.match(s)) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("exclude URL " + url);
                }
                return true;
            }
View Full Code Here

        }

        final String s = url.toString();
        Iterator i = includeCrawlingURL.iterator();
        while (i.hasNext()) {
            RE pattern = (RE) i.next();
            if (pattern.match(s)) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("include URL " + url);
                }
                return true;
            }
View Full Code Here

            if (!"".equals (regex)) {
                if (getLogger().isDebugEnabled())
                    getLogger().debug ("String parameter " + name +
                                       " should match regexp \"" + regex + "\"" );
                try {
                    RE r = new RE ( regex );
                    if ( !r.match(value) ) {
                        if (getLogger().isDebugEnabled())
                            getLogger().debug("and it does not match");
                        return new ValidatorActionHelper ( value, ValidatorActionResult.NOMATCH);
                    };
                } catch ( RESyntaxException rese ) {
View Full Code Here

            return null;
        }

        Map params = new HashMap();

        RE commaSplit = new RE(COMMA_SPLIT_REGEXP);
        RE equalsSplit = new RE(EQUALS_SPLIT_REGEXP);

        String[]  expressions = commaSplit.split(hintParams.trim());

        if (this.getLogger().isDebugEnabled()) {
            getLogger().debug("pipeline-hints: (aggregate-hint) " + hintParams);
        }

        for (int i=0; i<expressions.length;i++) {
            String [] nameValuePair = equalsSplit.split(expressions[i]);

            try {
                if (nameValuePair.length < 2) {
                    if (this.getLogger().isDebugEnabled()) {
                        getLogger().debug("pipeline-hints: (name) " + nameValuePair[0]
View Full Code Here

     */
    public void initialize()
        throws Exception {

        namespaceURI = JPATH_NAMESPACE_URI;
        m_re = new RE("id");
        m_cache = new HashMap();
    }
View Full Code Here

     * @param uri Uniform resource identifier.
     *
     * @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

Related Classes of org.apache.regexp.RE

Copyright © 2018 www.massapicom. 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.