Examples of PatternCompiler


Examples of org.apache.oro.text.regex.PatternCompiler

    } catch (Exception e) {
      if (LOG.isErrorEnabled()) { LOG.error("getJSLinks", e); }
    }

    try {
      final PatternCompiler cp = new Perl5Compiler();
      final Pattern pattern = cp.compile(STRING_PATTERN,
          Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
              | Perl5Compiler.MULTILINE_MASK);
      final Pattern pattern1 = cp.compile(URI_PATTERN,
              Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
                  | Perl5Compiler.MULTILINE_MASK);
      final PatternMatcher matcher = new Perl5Matcher();

      final PatternMatcher matcher1 = new Perl5Matcher();
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

    } catch (Exception e) {
      if (LOG.isErrorEnabled()) { LOG.error("getJSLinks", e); }
    }

    try {
      final PatternCompiler cp = new Perl5Compiler();
      final Pattern pattern = cp.compile(STRING_PATTERN,
          Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
              | Perl5Compiler.MULTILINE_MASK);
      final Pattern pattern1 = cp.compile(URI_PATTERN,
              Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
                  | Perl5Compiler.MULTILINE_MASK);
      final PatternMatcher matcher = new Perl5Matcher();

      final PatternMatcher matcher1 = new Perl5Matcher();
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

  public static Outlink[] getOutlinks(final String plainText, String anchor, Configuration conf) {
    long start = System.currentTimeMillis();
    final List<Outlink> outlinks = new ArrayList<Outlink>();

    try {
      final PatternCompiler cp = new Perl5Compiler();
      final Pattern pattern = cp.compile(URL_PATTERN,
          Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
              | Perl5Compiler.MULTILINE_MASK);
      final PatternMatcher matcher = new Perl5Matcher();

      final PatternMatcherInput input = new PatternMatcherInput(plainText);
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

  public Pattern getPattern(){ //laisy compilation of the regex.
    return this.regexPattern;
  }
  public void setRegex(String regex) {
    // would be better to get them from Avalon or so?
    PatternCompiler regexCompiler = new Perl5Compiler();
     if (regex != null){
      try {
        this.regexPattern = regexCompiler.compile(regex);
      } catch (MalformedPatternException e){
        this.regexPattern = null;
      }
    }
  }
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

      }
    }
  }
  public void setGlob(String mask) {
    // would be better to get them from Avalon or so?
   PatternCompiler globCompiler = new GlobCompiler();
    if (mask != null){
      try {
        this.regexPattern = globCompiler.compile(mask);
      } catch (MalformedPatternException e){
        this.regexPattern = null;
      }
    }
  }
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

   * @see ValueTransformer#transformValue(JMeterProperty)
   */
  public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
    PatternMatcher pm = JMeterUtils.getMatcher();
    Pattern pattern = null;
    PatternCompiler compiler = new Perl5Compiler();
    Iterator iter = getVariables().keySet().iterator();
    String input = prop.getStringValue();
    while (iter.hasNext()) {
      String key = (String) iter.next();
      String value = (String) getVariables().get(key);
      if (regexMatch) {
        try {
          pattern = compiler.compile(value);
          input = Util.substitute(pm, pattern,
              new StringSubstitution(FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX),
              input, Util.SUBSTITUTE_ALL);
        } catch (MalformedPatternException e) {
          log.warn("Malformed pattern " + value);
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

  public static Outlink[] getOutlinks(final String plainText, String anchor, Configuration conf) {
    long start = System.currentTimeMillis();
    final List<Outlink> outlinks = new ArrayList<Outlink>();

    try {
      final PatternCompiler cp = new Perl5Compiler();
      final Pattern pattern = cp.compile(URL_PATTERN,
          Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
              | Perl5Compiler.MULTILINE_MASK);
      final PatternMatcher matcher = new Perl5Matcher();

      final PatternMatcherInput input = new PatternMatcherInput(plainText);
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

    } catch (Exception e) {
      if (LOG.isErrorEnabled()) { LOG.error("getJSLinks", e); }
    }

    try {
      final PatternCompiler cp = new Perl5Compiler();
      final Pattern pattern = cp.compile(STRING_PATTERN,
          Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
          | Perl5Compiler.MULTILINE_MASK);
      final Pattern pattern1 = cp.compile(URI_PATTERN,
          Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
          | Perl5Compiler.MULTILINE_MASK);
      final PatternMatcher matcher = new Perl5Matcher();

      final PatternMatcher matcher1 = new Perl5Matcher();
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

    @Override
    public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
        PatternMatcher pm = JMeterUtils.getMatcher();
        Pattern pattern = null;
        PatternCompiler compiler = new Perl5Compiler();
        String input = prop.getStringValue();
        if(input == null) {
            return prop;
        }
        for(Entry<String, String> entry : getVariables().entrySet()){
            String key = entry.getKey();
            String value = entry.getValue();
            if (regexMatch) {
                try {
                    pattern = compiler.compile(constructPattern(value));
                    input = Util.substitute(pm, pattern,
                            new StringSubstitution(FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX),
                            input, Util.SUBSTITUTE_ALL);
                } catch (MalformedPatternException e) {
                    log.warn("Malformed pattern " + value);
View Full Code Here

Examples of org.apache.oro.text.regex.PatternCompiler

            if( value != null && 0 < value.length() && !STR_GLOBSTAR.equals( value ) )
            {
                try
                {
                    PatternCompiler pc = new GlobCompiler();

                    String[] ptrns = StringUtils.split( value, STR_COMMA );

                    result = new Pattern[ptrns.length];

                    for( int n = 0; n < ptrns.length; n++ )
                    {
                        result[n] = pc.compile( ptrns[n] );
                    }
                }
                catch( MalformedPatternException e )
                {
                    throw new PluginException( "Parameter " + name + " has a malformed pattern: " + e.getMessage() );
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.