Package org.apache.oro.text.regex

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


      else
        return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.regexp", new String[] {regexp}, FormsConstants.I18N_CATALOGUE));
    }
   
    private boolean matchesRegExp(String string) {
        PatternMatcher matcher = new Perl5Matcher();
        return matcher.matches(string, pattern);
    }
View Full Code Here


            enteredValue = newEnteredValue;
            validationError = null;
   
            if (enteredValue != null) {
                // try to split it
                PatternMatcher matcher = new Perl5Matcher();
                if (matcher.matches(enteredValue, definition.getSplitPattern())) {
                    MatchResult matchResult = matcher.getMatch();
                    Iterator iterator = definition.getSplitMappingsIterator();
                    while (iterator.hasNext()) {
                        SplitMapping splitMapping = (SplitMapping)iterator.next();
                        String result = matchResult.group(splitMapping.getGroup());
                        // Since we know the fields are guaranteed to have a string datatype, we
View Full Code Here

            return;
        }
        // Contains Strings and Integers
        List<Object> combined = new ArrayList<Object>();
        String rawTemplate = getTemplate();
        PatternMatcher matcher = JMeterUtils.getMatcher();
        Pattern templatePattern = JMeterUtils.getPatternCache().getPattern("\\$(\\d+)\\$"  // $NON-NLS-1$
                , Perl5Compiler.READ_ONLY_MASK
                & Perl5Compiler.SINGLELINE_MASK);
        if (log.isDebugEnabled()) {
            log.debug("Pattern = " + templatePattern.getPattern());
            log.debug("template = " + rawTemplate);
        }
        int beginOffset = 0;
        MatchResult currentResult;
        PatternMatcherInput pinput = new PatternMatcherInput(rawTemplate);
        while(matcher.contains(pinput, templatePattern)) {
            currentResult = matcher.getMatch();
            final int beginMatch = currentResult.beginOffset(0);
            if (beginMatch > beginOffset) { // string is not empty
                combined.add(rawTemplate.substring(beginOffset, beginMatch));
            }
            combined.add(Integer.valueOf(currentResult.group(1)));// add match as Integer
View Full Code Here

    String substitutedValue;
    if (getPattern() == null || this.substitute == null) {
      substitutedValue = bareValue;
    } else{
      Perl5Substitution ps = new Perl5Substitution(this.substitute);
      PatternMatcher mtch = new Perl5Matcher();
      substitutedValue = Util.substitute(mtch, getPattern(), ps, bareValue,
                                         Util.SUBSTITUTE_ALL );
    }
    return substitutedValue;
  }
View Full Code Here

  public boolean isAttributeValue(Entry entryToInspect)
  {
    String value = getBareAttributeValue(entryToInspect);
    Pattern pat = getPattern();
    if (pat != null) {
      PatternMatcher mtch = new Perl5Matcher();
      final boolean testValue = ( pat != null && mtch.contains(value, pat));
      return this.inverseLogic != testValue;
    }
    final boolean testValue = "true".equals(value);
    return this.inverseLogic != testValue;
  }
View Full Code Here

            ServletMappingInfo servletMappingInfo = (ServletMappingInfo) it.next();
            Pattern pattern = servletMappingInfo.getPattern();

            if (pattern != null)
            {
                PatternMatcher matcher = new Perl5Matcher();
               
                if ((matcher.matches(path, pattern)) || (matcher.matches(path + "/", pattern)))
                {
                    servlet = (Servlet) this.servletInstanceMap.get(servletMappingInfo.getServletName());
                    break;
                }
            }
View Full Code Here

        setVariables(variables);
        this.regexMatch = regexMatch;
    }

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

            return defaultValue;
        }

        List<MatchResult> collectAllMatches = new ArrayList<MatchResult>();
        try {
            PatternMatcher matcher = JMeterUtils.getMatcher();
            PatternMatcherInput input = new PatternMatcherInput(textToMatch);
            while (matcher.contains(input, searchPattern)) {
                MatchResult match = matcher.getMatch();
                collectAllMatches.add(match);
            }
        } catch (NumberFormatException e) {//TODO: can this occur?
            log.error("", e); //$NON-NLS-1$
            return defaultValue;
View Full Code Here

    public static String findFirst(String originalStr, String regex) {
        if (StringUtils.isBlank(originalStr) || StringUtils.isBlank(regex)) {
            return StringUtils.EMPTY;
        }

        PatternMatcher matcher = new Perl5Matcher();
        if (matcher.contains(originalStr, patterns.get(regex))) {
            return StringUtils.trimToEmpty(matcher.getMatch().group(0));
        }
        return StringUtils.EMPTY;
    }
View Full Code Here

    /**
     * 解析DataMedia中的namespace和name,支持offer[1-128]分库的定义
     */
    public static ModeValue parseMode(String value) {
        PatternMatcher matcher = new Perl5Matcher();
        if (matcher.matches(value, patterns.get(MODE_PATTERN))) {
            MatchResult matchResult = matcher.getMatch();
            String prefix = matchResult.group(1);
            String startStr = matchResult.group(3);
            String ednStr = matchResult.group(4);
            int start = Integer.valueOf(startStr);
            int end = Integer.valueOf(ednStr);
View Full Code Here

TOP

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

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.