Package org.apache.oro.text.regex

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


  }


  public int compare(Any other)
  {
    Pattern pattern = other.toPattern();
    return _pattern.getPattern().compareTo(pattern.toString());
  }
View Full Code Here


        flags = t.image.substring(i+1);
      } else {
        image = t.image;
        flags = "";
      }
      Pattern pattern = null;
      try {
        pattern = ObjectPool.createPattern(image, flags);
        push(new ConstantNode(new AnyPattern(pattern)));
      } catch (MalformedPatternException e) {
        error(toLocation(t), "Invalid regular expression: " + e.getMessage());
View Full Code Here


  private synchronized Any grep(Context context, Any keyPattern, Any valuePattern, boolean both)
  {
    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) {
View Full Code Here

        sEncoding = new CharacterSetDetector().detect(oHtmlStrm,"ASCII");
        oHtmlStrm.close();
        if (DebugFile.trace) DebugFile.writeln("Encoding set to "+sEncoding);
      }
     
      Pattern oPattern = oCompiler.compile("<base(\\x20)+href=(\"|')?([^'\"\\r\\n]+)(\"|')?(\\x20)*/?>", Perl5Compiler.CASE_INSENSITIVE_MASK);
    if (oMatcher.contains(sHtml, oPattern)) {
      sBaseHref = Gadgets.chomp(oMatcher.getMatch().group(3),"/");
      if (DebugFile.trace) DebugFile.writeln("<base href="+sBaseHref+">");
    }
 
View Full Code Here

    }
  
    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

    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);
View Full Code Here

    }

    private String getBoundaryStringFromContentType(String requestHeaders) {
        Perl5Matcher localMatcher = JMeterUtils.getMatcher();
        String regularExpression = "^" + HTTPSamplerBase.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$";
        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
        if(localMatcher.contains(requestHeaders, pattern)) {
            MatchResult match = localMatcher.getMatch();
            return match.group(1);
        }
        else {
View Full Code Here

    public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
            throws InvalidVariableException {
        String valueIndex = "", defaultValue = "", between = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        String name = ""; //$NON-NLS-1$
        String inputVariable = ""; //$NON-NLS-1$
        Pattern searchPattern;
        Object[] tmplt;
        try {
            searchPattern = JMeterUtils.getPatternCache().getPattern(((CompoundVariable) values[0]).execute(),
                    Perl5Compiler.READ_ONLY_MASK);
            tmplt = generateTemplate(((CompoundVariable) values[1]).execute());
View Full Code Here

        }
        return combined.toArray();
    }

    private boolean isFirstElementGroup(String rawData) {
        Pattern pattern = JMeterUtils.getPatternCache().getPattern("^\\$\\d+\\$"//$NON-NLS-1$
                Perl5Compiler.READ_ONLY_MASK);
        return JMeterUtils.getMatcher().contains(rawData, pattern);
    }
View Full Code Here

TOP

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

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.