Package org.apache.regexp

Examples of org.apache.regexp.RE.match()


                RE validGSAHosts = null;
                boolean validGSA = false;
                for (int i = 0; i < searchHosts.size(); i++) {
                    validGSAHosts =
                            new RE((String)searchHosts.elementAt(i), RE.MATCH_CASEINDEPENDENT);
                    if (validGSAHosts.match(requestGSA)) {
                        logger.debug(requestGSA +
                                     " is a valid GSA host for this configuration");
                        logger.info("Creating " + requestHost + " with " +
                                    requestGSA);
                        //Instantiate cookie to store the GSA host name that made this request
View Full Code Here


    {
        //was  Date:   Tue Nov 27 16:16:28 2007 +0100
        //iso  Date:   2007-11-24 01:13:10 +0100
        RE dateRegexp = new RE( "^Date:\\s*(.*)" );//new RE( "^Date:\\s*\\w-1\\w-1\\w-1\\s(.*)" );

        boolean match = dateRegexp.match( "Date:   2007-11-24 01:13:10 +0100" );
        String datestring = dateRegexp.getParen( 1 );
        assertEquals( "2007-11-24 01:13:10 +0100", datestring );
        assertTrue( match );

        GitChangeLogConsumer consumer = new GitChangeLogConsumer( new DefaultLog(), null );
View Full Code Here

                            return RENAME_DEVICE_ERROR_LENGTH;
                        } else if (oldName.equals(string)) {
                            return RENAME_DEVICE_ERROR_UNCHANGED;
                        } else if (dram.deviceExists(string)) {
                            return RENAME_DEVICE_ERROR_EXISTS;
                        } else if (deviceNameMatch.match(string)) {
                            if (deviceNameMatch.getParenLength(0) !=
                                    string.length()) {
                                return RENAME_DEVICE_ERROR_INVALID;
                            }
                        } else {
View Full Code Here

     * @param page the XDIME page
     */
    private RenderedPageCacheScope getPageCacheScope(String page) {
        RenderedPageCacheScope scope = null;
        RE regExpression = new RE(findCanvas);
        if (regExpression.match(page)) {
            String canvasAttributes = regExpression.getParen(2);
            regExpression.setProgram(findCacheScope);
            if (regExpression.match(canvasAttributes)) {
                scope = RenderedPageCacheScope.get(regExpression.getParen(1));
            }
View Full Code Here

        RenderedPageCacheScope scope = null;
        RE regExpression = new RE(findCanvas);
        if (regExpression.match(page)) {
            String canvasAttributes = regExpression.getParen(2);
            regExpression.setProgram(findCacheScope);
            if (regExpression.match(canvasAttributes)) {
                scope = RenderedPageCacheScope.get(regExpression.getParen(1));
            }
        }
        if (scope == null) {
            // lets look for an XDIME 2 cache directive
View Full Code Here

            }
        }
        if (scope == null) {
            // lets look for an XDIME 2 cache directive
            regExpression.setProgram(findMetaCacheScope);
            if (regExpression.match(page)) {
                scope = RenderedPageCacheScope.get(regExpression.getParen(2));
            }
        }
        if (scope == null) {
            // Canvas element did not specify a cache scope then we select the
View Full Code Here

     */
    public void testRegularExpression() throws Exception {
        RE re = new RE("[A-Za-z0-9\\-_@.]+");

        // Has to have at least one character.
        assertFalse(re.match(""));

        // Should be OK
        assertTrue(re.match("a"));

        // Test all chars/numbers
View Full Code Here

        // Has to have at least one character.
        assertFalse(re.match(""));

        // Should be OK
        assertTrue(re.match("a"));

        // Test all chars/numbers
        String alphabet = "abcdefghijklmnopqrstuvwxyz";
        String numbers = "0123456789";
View Full Code Here

        // Test all chars/numbers
        String alphabet = "abcdefghijklmnopqrstuvwxyz";
        String numbers = "0123456789";

        assertTrue(re.match(alphabet));
        assertTrue(re.match(alphabet.toUpperCase()));
        assertTrue(re.match(numbers));

        assertTrue(re.match("a_sentence.that-has@separators"));
View Full Code Here

        // Test all chars/numbers
        String alphabet = "abcdefghijklmnopqrstuvwxyz";
        String numbers = "0123456789";

        assertTrue(re.match(alphabet));
        assertTrue(re.match(alphabet.toUpperCase()));
        assertTrue(re.match(numbers));

        assertTrue(re.match("a_sentence.that-has@separators"));

        // Should match first part of string (up to '*' which is an illegal char)
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.