Regexp::NumRange - Create Regular Expressions for numeric ranges
Version 0.03
Regexp::NumRange is a package for generating regular expression strings. These strings can be used in a regular expression to correctly match numeric strings within only a specified range.
Example Usage:
use Test::More; use Regexp::NumRange qw/ rx_max /; my $rx = rx_max(255); like '100', qr/^$rx$/, '100 is less than 255'; unlike '256', qr/^$rx$/, '256 is greater tha 255';
Exports Available:
use Regexp::NumRange qw/ rx_max rx_range /;
Create a regex string between two arbitrary integers.
use Test::More; use Regexp::NumRange qw/ rx_range /; my $string = rx_range(256, 1024); my $rx = qr/^$string$/; ok "10" !~ $rx; ok "300" =~ $rx; ok "2000" !~ $rx;
Create a regex string between 0 and an arbitrary integer.
my $rx_string = rx_max(1024); # create a string matching numbers between 0 and 1024 is $rx_string, '(102[0-4]|10[0-1][0-9]|0?[0-9]{1,3})';
Regexp::Common::number - more variations, but restricted to number of digit matching
http://dev.perl.org/perl6/rfc/197.html - same goal, but for perl6!
Jacob R Rideout, <cpan at jacobrideout.net>
<cpan at jacobrideout.net>
Please report any bugs or feature requests to bug-regexp-numrange at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Regexp-NumRange. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-regexp-numrange at rt.cpan.org
Fork on github: https://github.com/jrideout/Regexp-NumRange
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Regexp-NumRange
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Regexp-NumRange
CPAN Ratings
http://cpanratings.perl.org/d/Regexp-NumRange
Search CPAN
http://search.cpan.org/dist/Regexp-NumRange/
Thanks to Module::Install
Copyright 2011 Jacob R Rideout.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Regexp::NumRange, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Regexp::NumRange
CPAN shell
perl -MCPAN -e shell install Regexp::NumRange
For more information on module installation, please visit the detailed CPAN module installation guide.