Package org.apache.oro.text.regex

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


          context = Context.getInstance();
        }
        throw context.exception(e);
      }
    }
    Perl5Matcher matcher = new Perl5Matcher();
    return matcher.contains(image.toString(), p);
  }
View Full Code Here


    return FALSE;
  }

  public Any execute(Context context, Any param1)
  {
    Perl5Matcher matcher = new Perl5Matcher();
    return matcher.contains(param1.toString(), _pattern) ? TRUE : FALSE;
  }
View Full Code Here

      if (matches_ instanceof AnyList) {
        list = (AnyList)matches_;
      }
    }
   
    Perl5Matcher matcher = new Perl5Matcher();
    if (isMatch ? matcher.matches(string, _pattern)
                : matcher.contains(string, _pattern))
    {
      if (array != null) {
        MatchResult match = matcher.getMatch();
        array.clear();
        int n = match.groups();
        for(int i=0; i<n; i++) {
          array.append(Any.create(match.group(i)));
        }
        return array;

      } else if (list != null) {
        MatchResult match = matcher.getMatch();
        list.clear();
        int n = match.groups();
        for(int i=0; i<n; i++) {
          list.append(Any.create(match.group(i)));
        }
View Full Code Here

  /// Splits given text to pieces according to this pattern.
  /// @synopsis array split(string text)
  public static final Object[] p_split = new Object[] { "text" };
  public Any m_split(String string)
  {
    Perl5Matcher matcher = new Perl5Matcher();
    Vector parts = Util.split(matcher, _pattern, string);
    Array array = new Array();
    int n = parts.size();
    for(int i=0; i<n; i++) {
      array.append(Any.create(parts.elementAt(i).toString()));
View Full Code Here

        substitution = new StringSubstitution(s);
      }
    } else {
      substitution = new AnyUtils.FunctionSubstitute(context, replacement);
    }
    Perl5Matcher matcher = new Perl5Matcher();
    return Any.create(Util.substitute(matcher, _pattern, substitution, string, substFlags));
  }
View Full Code Here

  {
    boolean match;
    Pattern kpattern = ObjectPool.createPattern(context, keyPattern);
    Pattern vpattern = ObjectPool.createPattern(context, valuePattern);
    if ((kpattern != null) || (vpattern != null)) {
      Perl5Matcher matcher = new Perl5Matcher();
      Array matched = new Array();
      Entry e = head;
      while(e != null) {
        Any key = e.key;
        Any value = e.value;
        if (kpattern != null) {
          match = matcher.contains(key.toString(), kpattern);
        } else {
          match = false;
        }
        if (vpattern != null) {
          if (both) {
            match = match && matcher.contains(value.toString(), vpattern);
          } else if (!match) {
            match = matcher.contains(value.toString(), vpattern);
          }
        }
        if (match) {
          matched.put(key, value);
        }
View Full Code Here

    String sEncoding;
  String sBaseHref = "";
  boolean bAutoDetectEncoding = true;
  TreeSet<String> oFiles = new TreeSet<String>();
  TreeSet<String> oEntries = new TreeSet<String>();
    Perl5Matcher oMatcher = new Perl5Matcher();
    Perl5Matcher oReplacer = new Perl5Matcher();
    Perl5Compiler oCompiler = new Perl5Compiler();

    try {
      String sHtml = readfilestr(sBasePath+sFilePath,"ASCII");
View Full Code Here

//            fail("Expected & length: " +contentLen + " in:\n"+requestHeaders);
//        }
    }
  
    private String getSentRequestHeaderValue(String requestHeaders, String headerName) {
        Perl5Matcher localMatcher = JMeterUtils.getMatcher();
        String expression = ".*" + headerName + ": (\\d*).*";
        Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK);
        if(localMatcher.matches(requestHeaders, pattern)) {
            // The value is in the first group, group 0 is the whole match
            return localMatcher.getMatch().group(1);
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    private boolean checkRegularExpression(String stringToCheck, String regularExpression) {
        Perl5Matcher localMatcher = JMeterUtils.getMatcher();
        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK);
        return localMatcher.contains(stringToCheck, pattern);
    }
View Full Code Here

        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK);
        return localMatcher.contains(stringToCheck, pattern);
    }

    private int getPositionOfBody(String stringToCheck) {
        Perl5Matcher localMatcher = JMeterUtils.getMatcher();
        // The headers and body are divided by a blank line
        String regularExpression = "^.$";
        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
       
        PatternMatcherInput input = new PatternMatcherInput(stringToCheck);
        while(localMatcher.contains(input, pattern)) {
            MatchResult match = localMatcher.getMatch();
            return match.beginOffset(0);
        }
        // No divider was found
        return -1;
    }
View Full Code Here

TOP

Related Classes of org.apache.oro.text.regex.Perl5Matcher

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.