Package org.apache.oro.text.regex

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


        String delim = null;

        if (parts == null) {
            Perl5Matcher matcher = JMeterUtils.getMatcher();
            PatternMatcherInput input = new PatternMatcherInput(headerLine);
            Pattern pattern = JMeterUtils.getPatternCache()
            // This assumes the header names are all single words with no spaces
            // word followed by 0 or more repeats of (non-word char + word)
            // where the non-word char (\2) is the same
            // e.g. abc|def|ghi but not abd|def~ghi
View Full Code Here


        String sql = createTestDatabase(TABLE_CONSTRAINT_TEST_SCHEMA);

        // Since we have no way of knowing the auto-generated variables in the SQL,
        // we simply try to extract it from the SQL
        Pattern             declarePattern     = new Perl5Compiler().compile("DECLARE @([\\S]+) [^@]+@([\\S]+)");
        PatternMatcherInput input              = new PatternMatcherInput(sql);
        PatternMatcher      matcher            = new Perl5Matcher();
        String[]            tableNameVars      = { "tablename", "tablename", "tablename" };
        String[]            constraintNameVars = { "constraintname", "constraintname", "constraintname" };

        for (int idx = 0; (idx < 3) && matcher.contains(input, declarePattern); idx++)
        {
            MatchResult result = matcher.getMatch();

            tableNameVars[idx]      = result.group(1);
            constraintNameVars[idx] = result.group(2);
            input.setCurrentOffset(result.endOffset(2));
        }
        assertEqualsIgnoringWhitespaces(
            "SET quoted_identifier on;\n"+
            "IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'F' AND name = 'testfk')\n"+
            "     ALTER TABLE \"table3\" DROP CONSTRAINT \"testfk\";\n"+
View Full Code Here

    }

    private int matchStrings(int matchNumber, Perl5Matcher matcher,
            Pattern pattern, List<MatchResult> matches, int found,
            String inputString) {
        PatternMatcherInput input = new PatternMatcherInput(inputString);
        while (matchNumber <=0 || found != matchNumber) {
            if (matcher.contains(input, pattern)) {
                log.debug("RegexExtractor: Match found!");
                matches.add(matcher.getMatch());
                found++;
View Full Code Here

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

        }

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

        List<String> pieces = new ArrayList<String>();
        // String or Integer
        List<Object> combined = new LinkedList<Object>();
        PatternMatcher matcher = JMeterUtils.getMatcher();
        Util.split(pieces, matcher, templatePattern, rawTemplate);
        PatternMatcherInput input = new PatternMatcherInput(rawTemplate);
        boolean startsWith = isFirstElementGroup(rawTemplate);
        if (startsWith) {
            pieces.remove(0);// Remove initial empty entry
        }
        Iterator<String> iter = pieces.iterator();
View Full Code Here

        Perl5Matcher localMatcher = JMeterUtils.getMatcher();
        // The headers and body are divided by a blank line (the \r is to allow for the CR before LF)
        String regularExpression = "^\\r$"; // $NON-NLS-1$
        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);

        PatternMatcherInput input = new PatternMatcherInput(stringToCheck);
        if(localMatcher.contains(input, pattern)) {
            MatchResult match = localMatcher.getMatch();
            return match.beginOffset(0);
        }
        // No divider was found
View Full Code Here

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

        String delim = null;

        if (parts == null){
            Perl5Matcher matcher = JMeterUtils.getMatcher();
            PatternMatcherInput input = new PatternMatcherInput(headerLine);
            Pattern pattern = JMeterUtils.getPatternCache()
            // This assumes the header names are all single words with no spaces
            // word followed by 0 or more repeats of (non-word char + word)
            // where the non-word char (\2) is the same
            // e.g.  abc|def|ghi but not abd|def~ghi
View Full Code Here

        }

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

TOP

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

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.