Constant(3)           User Contributed Perl Documentation          Constant(3)



SSYYNNOOPPSSIISS
         The following example shows how a complicated string, such as the date / time string from the unix "date" command, can be matched against a regular expression defined as a constant. The original regular expression is 5 lines long.

         use Regexp::Constant;

         my $date = "Mon Oct 25 11:59:13 EDT 2004";
         print $1 if $date =~ /@{[REGEX_SHELL_DATE]}/;
         exit();

AABBSSTTRRAACCTT
         WARNING - BETA SOFTWARE - NOT ALL REGEX’S HAVE BEEN TESTED

         A module for defining commonly used regular expressions as constants.

DDEESSCCRRIIPPTTIIOONN
       NNuummeerriicc rreegguullaarr eexxpprreessssiioonnss

        REGEX_SIGNED
        REGEX_BINARY
        REGEX_DECIMAL
        REGEX_FLOAT
        REGEX_HEX
        REGEX_OCTAL
        REGEX_OCTET

        REGEX_COMMA_DELIMITED_NUMBER

       MMYYSSQQLL ddaattaa ttyyppeess

        REGEX_TINYINT
        REGEX_TINYINT_SIGNED
        REGEX_SMALLINT
        REGEX_SMALLINT_SIGNED
        REGEX_MEDIUMINT
        REGEX_MEDIUMINT_SIGNED
        REGEX_INT
        REGEX_INT_SIGNED
        REGEX_BIGINT
        REGEX_BIGINT_SIGNED

       IIPP && hhoosstt mmaattcchhiinngg

        REGEX_MAC_ADDRESS
        REGEX_IP_CLASS_A
        REGEX_IP_CLASS_B
        REGEX_IP_CLASS_C
        REGEX_IP_ADDRESS
        REGEX_DOMAIN_NAME
        REGEX_EMAIL_ADDRESS

       TTiimmee

        REGEX_HOUR
        REGEX_MINUTE
        REGEX_SECOND
        REGEX_TIME
        REGEX_GMT_OFFSET
        REGEX_TIMEZONE

       DDaattee

        REGEX_DAY
        REGEX_WEEKDAY_ABBREVIATED
        REGEX_WEEKDAY_NAME
        REGEX_WEEKDAY
        REGEX_MONTH_NUMERIC
        REGEX_MONTH_NAME_ABBREVIATED
        REGEX_MONTH_NAME
        REGEX_MONTH
        REGEX_YEAR
        REGEX_ROMAN_NUMERAL

       DDaatteeTTiimmee

        REGEX_CLF_DATE
        REGEX_MYSQL_DATE
        REGEX_CLF_DATETIME
        REGEX_MYSQL_DATETIME
        REGEX_SHELL_DATE

       TTeelleepphhoonnee ((UUSS))

        REGEX_AREA_CODE
        REGEX_PHONE_EXCHANGE
        REGEX_PHONE_EXTENSION
        REGEX_PHONE

       HHTTMMLL

        REGEX_HTML_SIMPLE

       UURRII && wweebb sseerrvveerr lloogg

        REGEX_REQUEST_METHOD
        REGEX_REQUEST_OBJECT
        REGEX_URI
        REGEX_PROTOCOL
        REGEX_RESPONSE_CODE
        REGEX_CONTENT_LENGTH
        REGEX_HTTP_REFERER
        REGEX_HTTP_USER_AGENT
        REGEX_COOKIE

       RReeggiioonn ((UUSS))

        REGEX_STATE
        REGEX_STATE_ABBREVIATION
        REGEX_ZIP_CODE
        REGEX_ZIP_CODE_PLUS_FOUR

       MMiisscceellllaanneeoouuss

        REGEX_REPEATED_WORD
        REGEX_WINDOWS_FILENAME
        REGEX_NUMBER
        REGEX_WORD_UNCAPITALIZED
        REGEX_WORD_CAPITALIZED

       IIDD

        REGEX_MD5
        REGEX_GUID
        REGEX_ISBN
        REGEX_SSN

       CCrreeddiitt CCaarrdd

        REGEX_VISA
        REGEX_MASTERCARD
        REGEX_DISCOVER
        REGEX_DINERS_CLUB
        REGEX_AMERICAN_EXPRESS
        REGEX_CREDIT_CARD
        REGEX_CREDIT_CARD_EXPIRATION
        REGEX_CREDIT_CARD_VALIDATION

       EEXXPPOORRTT

       None by default.

PPRREERREEQQUUIISSIITTEESS
       None.

BBUUGGSS
       Some values are not defined, or use basic matching (HTML, Cookie, etc).

       Telephone does not properly match paranthesis around area code.

       Many REGEX untested or partially tested.

AAUUTTHHOORR
       David Tiberio, <dtiberio5@hotmail.com>

CCOOPPYYRRIIGGHHTT AANNDD LLIICCEENNSSEE
       Copyright 2004 David Tiberio, dtiberio5@hotmail.com

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.



perl v5.8.0                       2004-10-25                       Constant(3)
