Package org.apache.regexp

Examples of org.apache.regexp.RE


                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);
                }
            }
        } else {
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Include all URLs");
            }
        }

        children = configuration.getChildren(EXCLUDE_CONFIG);
        if (children != null && 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("Excluded 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("Included URL " + url);
                }
                return true;
            }
View Full Code Here

  private RE expression;

  public void configure(Configuration configuration) throws ConfigurationException {
    expressionString = "^[a-zA-Z0-9]+[a-zA-Z0-9-_.]*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)+$";
    try {
      expression = new RE(expressionString);
    }
    catch (RESyntaxException e) {
      throw new ConfigurationException("",e);
    }
  }
View Full Code Here

        if ( constraint != null )
        {
            String param = constraint.getValue();
            try
            {
                mask = new RE(param);
            }
            catch (org.apache.regexp.RESyntaxException e)
            {
                throw new TurbineException(e);
            }
View Full Code Here

        getLogger().debug("depth: " + this.depth);

        String rePattern = par.getParameter("root", null);
        try {
            getLogger().debug("root pattern: " + rePattern);
            this.rootRE = (rePattern == null)?null:new RE(rePattern);

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

            rePattern = par.getParameter("exclude", null);
            getLogger().debug("exclude pattern: " + rePattern);
            this.excludeRE = (rePattern == null)?null:new RE(rePattern);
        } catch (RESyntaxException rese) {
            getLogger().error("Syntax error in regexp pattern '" + rePattern + "'", rese);
            throw new ProcessingException("Syntax error in regexp pattern '"
                + rePattern + "'", rese);
        }
View Full Code Here

            // Validate wheter param matches regular expression
            if (!"".equals (regex)) {
                getLogger().debug ("VALIDATOR: string parameter " + name +
                        " should match regexp \"" + regex + "\"" );
                try {
                    RE r = new RE ( regex );
                    if ( !r.match(value) ) {
                        getLogger().debug("VALIDATOR: and it does not match");
                        return new ValidatorActionHelper ( value, ValidatorActionResult.NOMATCH);
                    };
                } catch ( RESyntaxException rese ) {
                    getLogger().error ("VALIDATOR: string parameter " + name +
View Full Code Here

    ) throws Exception {

        // obtain locale information (note, Locale.get* do not return null)
        String lc = getLocale(objectModel);

        String[] matches = new RE("_").split(lc);

        String l = matches.length > 0
                   ? matches[0] : Locale.getDefault().getLanguage();
        String c = matches.length > 1 ? matches[1] : "";
        String v = matches.length > 2 ? matches[2] : "";
View Full Code Here

                result.append(c);
            }
        }
        argument = result.toString();

        RE reg = getCompiledPattern(options);
        int sOptions = getSubsOptions(options);
        return reg.subst(input, argument, sOptions);
    }   
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.