Skip to content

Commit

Permalink
Import of ABIGAIL/Regexp-Common-1.20 from CPAN.
Browse files Browse the repository at this point in the history
gitpan-cpan-distribution: Regexp-Common
gitpan-cpan-version:      1.20
gitpan-cpan-path:         ABIGAIL/Regexp-Common-1.20.tar.gz
gitpan-cpan-author:       ABIGAIL
gitpan-cpan-maturity:     released
  • Loading branch information
Abigail authored and Gitpan committed Oct 22, 2014
1 parent dce8a26 commit e894ea2
Show file tree
Hide file tree
Showing 10 changed files with 941 additions and 441 deletions.
27 changes: 21 additions & 6 deletions README
@@ -1,7 +1,10 @@
==============================================================================
Release of version 0.02 of Regexp::Common
Release of version 1.20 of Regexp::Common
==============================================================================

NOTE: The jump from version 0.09 to 1.20 does not indicate a significant
change in the API, or any other significant change. It's just that
the version number now follows the revision number from CVS.

NAME

Expand Down Expand Up @@ -35,18 +38,19 @@ DESCRIPTION
* balanced parentheses and brackets
* delimited text (with escapes)
* integers and floating-point numbers in any base (up to 36)
* comments in C, C++, Perl, and shell
* comments in 39 languages
* offensive language
* lists of any pattern
* IPv4 addresses
* URIs.

Future releases of the module will also provide patterns for the
following:

* email addresses
* HTML/XML tags
* mail headers (including multiline ones),
* URLS (various genres)
* more URIs
* telephone numbers of various countries
* currency (universal 3 letter format, Latin-1, currency names)
* dates
Expand All @@ -55,7 +59,7 @@ DESCRIPTION

INSTALLATION

It's all pure Perl, so just put the .pm file in its appropriate
It's all pure Perl, so just put the .pm files in their appropriate
local Perl subdirectory.


Expand All @@ -64,9 +68,14 @@ AUTHOR
Damian Conway (damian@cs.monash.edu.au)


MAINTAINER

Abigail (regexp-common@abigail.nl)


COPYRIGHT

Copyright (c) 1997-2000, Damian Conway. All Rights Reserved.
Copyright (c) 1997-2002, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)
Expand All @@ -75,10 +84,16 @@ COPYRIGHT

==============================================================================

CHANGES IN VERSION 0.06
CHANGES IN VERSION 1.20

Revision history for Perl extension Regexp::Common.

1.20 Tue Aug 27 19:06:13 CEST 2002
- Balanced patterns can now take multiple sets of arbitrary
strings as delimiters.
- Fax URIs.
- More comment patterns.

0.09 Tue Aug 6 16:44:57 CEST 2002
- Fixed $RE{URI}{tel}, local phone numbers can have
future extensions as well.
Expand Down
9 changes: 6 additions & 3 deletions lib/Regexp/Common.pm
Expand Up @@ -8,7 +8,7 @@ local $^W = 1;
use vars qw /$VERSION %RE %sub_interface/;


$VERSION = '0.09';
($VERSION) = q $Revision: 1.20 $ =~ /([\d.]+)/;

use Carp;

Expand Down Expand Up @@ -699,7 +699,7 @@ Provides regexes for strings with balanced parenthesized delimiters.
=item Regexp::Common::comment
Provides regexes for comments of various languages (26 languages
Provides regexes for comments of various languages (39 languages
currently).
=item Regexp::Common::delimited
Expand Down Expand Up @@ -736,7 +736,7 @@ Future releases of the module will also provide patterns for the following:
* HTML/XML tags
* more numerical matchers,
* mail headers (including multiline ones),
* URLS (various genres)
* more URLS
* telephone numbers of various countries
* currency (universal 3 letter format, Latin-1, currency names)
* dates
Expand Down Expand Up @@ -801,6 +801,9 @@ project, especially: Elijah, Jarkko, Tom, Nat, Ed, and Vivek.
=head1 HISTORY
$Log: Common.pm,v $
Revision 1.20 2002/08/27 17:04:29 abigail
VERSION is now extracted from the CVS revision number.
Revision 1.19 2002/08/06 14:46:49 abigail
Upped version number to 0.09.
Expand Down
104 changes: 74 additions & 30 deletions lib/Regexp/Common/URI.pm
@@ -1,4 +1,4 @@
# $Id: URI.pm,v 1.7 2002/08/06 14:44:07 abigail Exp $
# $Id: URI.pm,v 1.8 2002/08/27 16:56:27 abigail Exp $

package Regexp::Common::URI; {

Expand All @@ -9,7 +9,7 @@ use Regexp::Common qw /pattern clean no_defaults/;

use vars qw /$VERSION/;

($VERSION) = q $Revision: 1.7 $ =~ /[\d.]+/g;
($VERSION) = q $Revision: 1.8 $ =~ /[\d.]+/g;

# RFC 2396, base definitions.
my $digit = '[0-9]';
Expand Down Expand Up @@ -170,46 +170,81 @@ my $phone_context_tag = "(?:phone-context)";
my $area_specifier = "(?:;$phone_context_tag=$phone_context_ident)";
my $post_dial = "(?:;postd=[0-9\\-.()*#ABCDwp]+)";
my $isdn_subaddress = "(?:;isub=[0-9\\-.()]+)";
my $local_phone_number= "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
"$post_dial?$area_specifier" .
"(?:$area_specifier|$service_provider|" .
my $t33_subaddress = "(?:;tsub=[0-9\\-.()]+)";

my $local_phone_number= "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
"$post_dial?$area_specifier" .
"(?:$area_specifier|$service_provider|" .
"$future_extension)*)";
my $local_phone_number_no_future
= "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
"$post_dial?$area_specifier" .
= "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
"$post_dial?$area_specifier" .
"(?:$area_specifier|$service_provider)*)";
my $fax_local_phone = "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
"$t33_subaddress?$post_dial?$area_specifier" .
"(?:$area_specifier|$service_provider|" .
"$future_extension)*)";
my $fax_local_phone_no_future
= "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
"$t33_subaddress?$post_dial?$area_specifier" .
"(?:$area_specifier|$service_provider)*)";
my $base_phone_number = "(?:[0-9\\-.()]+)";
my $global_phone_number
= "(?:[+]$base_phone_number$isdn_subaddress?" .
"$post_dial?" .
"(?:$area_specifier|$service_provider|" .
= "(?:[+]$base_phone_number$isdn_subaddress?" .
"$post_dial?" .
"(?:$area_specifier|$service_provider|" .
"$future_extension)*)";
my $global_phone_number_no_future
= "(?:[+]$base_phone_number$isdn_subaddress?" .
"$post_dial?" .
= "(?:[+]$base_phone_number$isdn_subaddress?" .
"$post_dial?" .
"(?:$area_specifier|$service_provider)*)";
my $fax_global_phone = "(?:[+]$base_phone_number$isdn_subaddress?" .
"$t33_subaddress?$post_dial?" .
"(?:$area_specifier|$service_provider|" .
"$future_extension)*)";
my $fax_global_phone_no_future
= "(?:[+]$base_phone_number$isdn_subaddress?" .
"$t33_subaddress?$post_dial?" .
"(?:$area_specifier|$service_provider)*)";
my $telephone_subscriber
= "(?:$global_phone_number|$local_phone_number)";
my $telephone_subscriber_no_future
= "(?:$global_phone_number_no_future|" .
"$local_phone_number_no_future)";
my $fax_subscriber = "(?:$fax_global_phone|$fax_local_phone)";
my $fax_subscriber_no_future
= "(?:$fax_global_phone_no_future|" .
"$fax_local_phone_no_future)";

my $telephone_scheme = "(?:tel)";
my $fax_scheme = "(?:fax)";
my $telephone_url = "(?:$telephone_scheme:$telephone_subscriber)";
my $telephone_url_no_future
= "(?:$telephone_scheme:" .
"$telephone_subscriber_no_future)";
my $fax_url = "(?:$fax_scheme:$fax_subscriber)";
my $fax_url_no_future = "(?:$fax_scheme:$fax_subscriber_no_future)";

$uri {tel} = $telephone_url;
$uri {fax} = $fax_url;

pattern name => [qw (URI tel)],
create => "(?k:(?k:$telephone_scheme):(?k:$telephone_subscriber))";
create => "(?k:(?k:$telephone_scheme):(?k:$telephone_subscriber))",
;

pattern name => [qw (URI tel nofuture)],
create => "(?k:(?k:$telephone_scheme):" .
"(?k:$telephone_subscriber_no_future))"
;

pattern name => [qw (URI fax)],
create => "(?k:(?k:$fax_scheme):(?k:$fax_subscriber))",
;

pattern name => [qw (URI fax nofuture)],
create => "(?k:(?k:$fax_scheme):(?k:$fax_subscriber_no_future))",
;

}

1;
Expand Down Expand Up @@ -415,6 +450,12 @@ the correct syntax for post dial, service provider, phone context,
etc has been used - otherwise the regex could always classify them
as a I<future extension>.
=head2 $RE{URI}{fax} and $RE{URI}{fax}{nofuture}
Similar to C<$RE{URI}{tel}> and C<$RE{URI}{tel}{nofuture}>, except that
it will return patterns matching fax URIs, as defined in RFC 2806.
C<{-keep}> will return the same fragments as for tel URIs.
=head1 REFERENCES
=over 4
Expand Down Expand Up @@ -452,29 +493,32 @@ Vaha-Sipila, A.: I<URLs for Telephone Calls>. April 2000.
=head1 HISTORY
$Log: URI.pm,v $
Revision 1.7 2002/08/06 14:44:07 abigail
Local phone numbers can have future extensions as well.
$Log: URI.pm,v $
Revision 1.8 2002/08/27 16:56:27 abigail
Support for fax URIs.
Revision 1.7 2002/08/06 14:44:07 abigail
Local phone numbers can have future extensions as well.
Revision 1.6 2002/08/06 13:18:03 abigail
Cosmetic changes
Revision 1.6 2002/08/06 13:18:03 abigail
Cosmetic changes
Revision 1.5 2002/08/06 13:16:27 abigail
Added $RE{URI}{tel}{nofuture}
Revision 1.5 2002/08/06 13:16:27 abigail
Added $RE{URI}{tel}{nofuture}
Revision 1.4 2002/08/06 00:03:30 abigail
Added $RE{URI}{tel}
Revision 1.4 2002/08/06 00:03:30 abigail
Added $RE{URI}{tel}
Revision 1.3 2002/08/04 22:51:35 abigail
Added FTP URIs.
Revision 1.3 2002/08/04 22:51:35 abigail
Added FTP URIs.
Revision 1.2 2002/07/25 22:37:44 abigail
Added 'use strict'.
Added 'no_defaults' to 'use Regex::Common' to prevent loading of all
defaults.
Revision 1.2 2002/07/25 22:37:44 abigail
Added 'use strict'.
Added 'no_defaults' to 'use Regex::Common' to prevent loading of all
defaults.
Revision 1.1 2002/07/25 19:56:07 abigail
Modularizing Regexp::Common.
Revision 1.1 2002/07/25 19:56:07 abigail
Modularizing Regexp::Common.
=head1 SEE ALSO
Expand Down

0 comments on commit e894ea2

Please sign in to comment.