Package org.apache.oro.text.perl

Examples of org.apache.oro.text.perl.Perl5Util.match()


        }

        Perl5Util matchUrlPat = new Perl5Util();
        Perl5Util matchAsciiPat = new Perl5Util();

        if (!matchAsciiPat.match(LEGAL_ASCII_PATTERN, value)) {
            return false;
        }

        // Check the whole url address structure
        if (!matchUrlPat.match(URL_PATTERN, value)) {
View Full Code Here


            return false;
        }

        Perl5Util pathMatcher = new Perl5Util();

        if (!pathMatcher.match(PATH_PATTERN, path)) {
            return false;
        }

        //if (path.endsWith("/")) {
        //    return false;
View Full Code Here

             
              // Replace singe quote's with double quotes (only if they match)
              String subquery = util.substitute("s/\'(.*)\'/\"$1\"/g", field.getQuery());
             
              // If the field is not quoted ...
              if (!util.match("/\".*\"/", subquery))
                {
                // ... then seperate each word and re-specify the search field.
                    subquery = util.substitute("s/ / " + field.getField() + ":/g", subquery);
                }
             
View Full Code Here

    public void testFindScript()
    {
        Perl5Util util = new Perl5Util();
        String expr = "/(?:<script.*?>)((\\n|.)*?)(?:<\\/script>)/";
       
        assertTrue(util.match(expr, JAVASCRIPT_NOCOMMENT));
       
        MatchResult result = util.getMatch();
        assertNotNull(result);
        assertEquals(3, result.groups());
        assertEquals("if (document.updateObject) { document.updateObject.progressFinished('updateId');}",
View Full Code Here

    public void testFindMultipleScripts()
    {
        Perl5Util util = new Perl5Util();
        String expr = "/(?:<script.*?>)((\\n|.)*?)(?:<\\/script>)/";
       
        assertTrue(util.match(expr, MULTI_JAVASCRIPT_NOCOMMENT));
       
        MatchResult result = util.getMatch();
        assertNotNull(result);
        assertEquals(3, result.groups());
        assertEquals("if (document.updateObject) { document.updateObject.progressFinished('updateId');}"
View Full Code Here

        {
            contents = perl.substitute(makeSubstRE(i), contents);
        }

        // Convert closing curlies.
        if (perl.match("m/javascript/i", contents))
        {
            // ASSUMPTION: JavaScript is indented, WM is not.
            contents = perl.substitute("s/\n}/\n#end/g", contents);
        }
        else
View Full Code Here

        if (email == null) {
            return false;
        }

        Perl5Util matchAsciiPat = new Perl5Util();
        if (!matchAsciiPat.match(LEGAL_ASCII_PATTERN, email)) {
            return false;
        }

        // Check the whole email address structure
        Perl5Util emailMatcher = new Perl5Util();
View Full Code Here

            return false;
        }

        // Check the whole email address structure
        Perl5Util emailMatcher = new Perl5Util();
        if (!emailMatcher.match(EMAIL_PATTERN, email)) {
            return false;
        }

        if (email.endsWith(".")) {
            return false;
View Full Code Here

     */
    protected boolean isValidDomain(String domain) {
        boolean symbolic = false;
        Perl5Util ipAddressMatcher = new Perl5Util();

        if (ipAddressMatcher.match(IP_DOMAIN_PATTERN, domain)) {
            if (!isValidIpAddress(ipAddressMatcher)) {
                return false;
            }
        } else {
            // Domain is symbolic name
View Full Code Here

                return false;
            }
        } else {
            // Domain is symbolic name
            Perl5Util domainMatcher = new Perl5Util();
            symbolic = domainMatcher.match(DOMAIN_PATTERN, domain);
        }

        if (symbolic) {
            if (!isValidSymbolicDomain(domain)) {
                return false;
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.