SYNOPSIS
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();
ABSTRACT
WARNING - BETA SOFTWARE - NOT ALL REGEX'S HAVE BEEN TESTED
A module for defining commonly used regular expressions as constants.
DESCRIPTION
Numeric regular expressions
REGEX_SIGNED
REGEX_BINARY
REGEX_DECIMAL
REGEX_FLOAT
REGEX_HEX
REGEX_OCTAL
REGEX_OCTET
REGEX_COMMA_DELIMITED_NUMBER
MYSQL data types
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
IP & host matching
REGEX_MAC_ADDRESS
REGEX_IP_CLASS_A
REGEX_IP_CLASS_B
REGEX_IP_CLASS_C
REGEX_IP_ADDRESS
REGEX_DOMAIN_NAME
REGEX_EMAIL_ADDRESS
Time
REGEX_HOUR
REGEX_MINUTE
REGEX_SECOND
REGEX_TIME
REGEX_GMT_OFFSET
REGEX_TIMEZONE
Date
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
DateTime
REGEX_CLF_DATE
REGEX_MYSQL_DATE
REGEX_CLF_DATETIME
REGEX_MYSQL_DATETIME
REGEX_SHELL_DATE
Telephone (US)
REGEX_AREA_CODE
REGEX_PHONE_EXCHANGE
REGEX_PHONE_EXTENSION
REGEX_PHONE
HTML
REGEX_HTML_SIMPLE
URI & web server log
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
Region (US)
REGEX_STATE
REGEX_STATE_ABBREVIATION
REGEX_ZIP_CODE
REGEX_ZIP_CODE_PLUS_FOUR
Miscellaneous
REGEX_REPEATED_WORD
REGEX_WINDOWS_FILENAME
REGEX_NUMBER
REGEX_WORD_UNCAPITALIZED
REGEX_WORD_CAPITALIZED
ID
REGEX_MD5
REGEX_GUID
REGEX_ISBN
REGEX_SSN
Credit Card
REGEX_VISA
REGEX_MASTERCARD
REGEX_DISCOVER
REGEX_DINERS_CLUB
REGEX_AMERICAN_EXPRESS
REGEX_CREDIT_CARD
REGEX_CREDIT_CARD_EXPIRATION
REGEX_CREDIT_CARD_VALIDATION
EXPORT
None by default.
PREREQUISITES
None.
BUGS
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.
AUTHOR
David Tiberio, <dtiberio5@hotmail.com>
COPYRIGHT AND LICENSE
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.