Regexp::MinLength - Perl extension for determining the minimum matching length for a regular expression


Regexp-MinLength documentation Contained in the Regexp-MinLength distribution.

Index


Code Index:

NAME

Top

Regexp::MinLength - Perl extension for determining the minimum matching length for a regular expression

SYNOPSIS

Top

  use Regexp::MinLength qw(MinLength);
  my $min = MinLength($regex);

DESCRIPTION

Top

This module determines the minimum matching length for a regular expression.

USAGE

Top

MinLength(regular_expression)

Returns the minimum matching length, that is, the length of the shortest string that will match the given regular expression.

EXAMPLE

Top

my $regex = "\\d"; my $min = MinLength($regex);

SEE ALSO

Top

See Regexp::Parser

AUTHOR

Top

Leigh Metcalf, <leigh@fprime.net<gt>

COPYRIGHT AND LICENSE

Top


Regexp-MinLength documentation Contained in the Regexp-MinLength distribution.

package Regexp::MinLength;

use 5.10.1;
use strict;
use warnings;
use Carp;

require Exporter;
use AutoLoader;

our @ISA = qw(Exporter);

our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(
	MinLength
);

our $VERSION = '0.03';

sub AUTOLOAD {
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.

    my $constname;
    our $AUTOLOAD;
    ($constname = $AUTOLOAD) =~ s/.*:://;
    croak "&Regexp::constant not defined" if $constname eq 'constant';
    my ($error, $val) = constant($constname);
    if ($error) { croak $error; }
    {
	no strict 'refs';
	*$AUTOLOAD = sub { $val };
    }
    goto &$AUTOLOAD;
}

require XSLoader;
XSLoader::load('Regexp::MinLength', $VERSION);

# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit program.

1;
__END__
# Below is stub documentation for your module. You'd better edit it!