Examples of RegexpMatcher


Examples of org.apache.tapestry.util.RegexpMatcher

        assertTrue(!m.matches("foo|foot", "foot"));
    }

    public void testBadPattern()
    {
        RegexpMatcher m = new RegexpMatcher();

        try
        {
            m.matches("[[[", "x");

            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        }
    }

    public void testClear()
    {
        RegexpMatcher m = new RegexpMatcher();

        m.clear();
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        m.clear();
    }

    public void testContains()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(m.contains("[a-z]+", "c"));
        assertTrue(m.contains("^(\\d{5}(-\\d{4})?)$", "06514"));
        assertTrue(m.contains("^(\\d{5}(-\\d{4})?)$", "06514-3149"));
        assertTrue(m.contains("foo|foot", "12foot12"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        assertTrue(m.contains("foo|foot", "12foot12"));
    }

    public void testNotContains()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(!m.contains("[0-9]+", "q"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "0651"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "065147"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "06514-314"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "06514-31497"));
        assertTrue(!m.contains("^(foo|foot)$", "12foot12"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        assertTrue(!m.contains("^(foo|foot)$", "12foot12"));
    }

    public void testGetEscapedPatternStrings()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertEquals(m.getEscapedPatternString("^\\d$"), "\\^\\\\d\\$");
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

    /** @since 3.1 */

    public void testGetMatches()
    {
        RegexpMatcher m = new RegexpMatcher();

        String[] matches = m.getMatches("\\d+", "57,232 89 147", 0);

        assertListsEqual(new String[]
        { "57", "232", "89", "147" }, matches);
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

    /** @since 3.1 */

    public void testGetMatchesNoMatch()
    {
        RegexpMatcher m = new RegexpMatcher();

        String[] matches = m.getMatches("A(B|C)", "aBCAaBA", 0);

        assertEquals(0, matches.length);
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

    /** @since 3.1 */

    public void testGetMatchesSubgroup()
    {
        RegexpMatcher m = new RegexpMatcher();

        String matches[] = m.getMatches("A(B|C|fred)", "AA AC AB Afred AA AC", 1);

        assertListsEqual(new String[]
        { "C", "B", "fred", "C" }, matches);
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

            return Collections.EMPTY_LIST;

        List result = new ArrayList();
        String chopped = specification;

        RegexpMatcher matcher = new RegexpMatcher();

        while (true)
        {
            if (chopped.length() == 0)
                break;

            if (!result.isEmpty())
            {
                if (chopped.charAt(0) != ',')
                    throw new ApplicationRuntimeException(ValidatorMessages
                            .badSpecification(specification));

                chopped = chopped.substring(1);
            }

            RegexpMatch[] matches = matcher.getMatches(PATTERN, chopped);

            if (matches.length != 1)
                throw new ApplicationRuntimeException(ValidatorMessages.badSpecification(specification));

            RegexpMatch match = matches[0];
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

    }

    public RegexpMatcher getMatcher()
    {
        if (_matcher == null)
            _matcher = new RegexpMatcher();

        return _matcher;
    }
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.