Package org.apache.oro.text.perl

Examples of org.apache.oro.text.perl.Perl5Util


     */
    private Map getPackageInfo()
    {
        TreeMap allPackages = new TreeMap();
        TreeMap allClasses = new TreeMap();
        Perl5Util perl = new Perl5Util();

        Enumeration packages = packageManager.getPackageTypes();
        while ( packages.hasMoreElements() )
        {
            PackageType pkg = (PackageType) packages.nextElement();
            String pkgName = pkg.getName();
            String pkgDir = perl.substitute( "s/\\./\\//g", pkgName );
            String rootRef = perl.substitute( "s/[^\\.]*(\\.|$)/..\\//g", pkgName );

            // special case for the default package
            // javadoc doesn't deal with it, but it's easy for us
            if ( pkgName.length() == 0 )
            {
View Full Code Here


    if(pvPhone == null) return true;

    final String phoneNumber = ((String) pvPhone).trim().toLowerCase();
    final String country = pvCountry == null ? "us" : ((String) pvCountry).trim().toLowerCase();

    return (new Perl5Util()).match(ValidationUtil.isValidUsaStateAbbr(country) ? ValidationUtil.US_PHONE_REGEXP
        : ValidationUtil.INTNL_PHONE_REGEXP, phoneNumber);
  }
View Full Code Here

  }

  @Override
  public boolean isValid(String value, ConstraintValidatorContext context) {
    if(value == null) return true;
    return (value.length() < 9) ? false : (new Perl5Util()).match(ValidationUtil.SSN_REGEXP, StringUtils.strip(value));
  }
View Full Code Here

    final String postalCode = ((String) pvPostalCode).trim().toLowerCase();
    final String country = pvCountry == null ? "us" : ((String) pvCountry).trim().toLowerCase();

    if(ValidationUtil.isValidUsaStateAbbr(country)) {
      return (new Perl5Util()).match(ValidationUtil.US_ZIPCODE_REGEXP, postalCode);
    }

    // currently no validation for internation postal codes
    return true;
  }
View Full Code Here

    if(pvPhone == null) return true;

    final String phoneNumber = ((String) pvPhone).trim().toLowerCase();
    final String country = pvCountry == null ? "us" : ((String) pvCountry).trim().toLowerCase();

    return (new Perl5Util()).match(ValidationUtil.isValidUsaStateAbbr(country) ? ValidationUtil.US_PHONE_REGEXP
        : ValidationUtil.INTNL_PHONE_REGEXP, phoneNumber);
  }
View Full Code Here

    // no-op
  }

  public boolean isValid(String value, ConstraintValidatorContext context) {
    if(value == null) return true;
    return (value.length() < 9) ? false : (new Perl5Util()).match(ValidationUtil.SSN_REGEXP, StringUtils.strip(value));
  }
View Full Code Here

    final String postalCode = ((String) pvPostalCode).trim().toLowerCase();
    final String country = pvCountry == null ? "us" : ((String) pvCountry).trim().toLowerCase();

    if(ValidationUtil.isValidUsaStateAbbr(country)) {
      return (new Perl5Util()).match(ValidationUtil.US_ZIPCODE_REGEXP, postalCode);
    }

    // currently no validation for internation postal codes
    return true;
  }
View Full Code Here

    public static boolean matchRegexp(String value, String regexp) {
        if (regexp == null || regexp.length() <= 0) {
            return false;
        }

        Perl5Util matcher = new Perl5Util();
        return matcher.match("/" + regexp + "/", value);
    }
View Full Code Here

    public boolean isValid(String email) {
        if (email == null) {
            return false;
        }

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

        email = stripComments(email);

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

        if (email.endsWith(".")) {
            return false;
        }

        if (!isValidUser(emailMatcher.group(1))) {
            return false;
        }

        if (!isValidDomain(emailMatcher.group(2))) {
            return false;
        }

        return true;
    }
View Full Code Here

     *                being validatied.
     * @return true if the email address's domain is valid.
     */
    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 {
                return true;
            }
        } 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

Related Classes of org.apache.oro.text.perl.Perl5Util

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.