The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Text::MatchedPosition - find the matched position in a text

SYNOPSIS

    use Text::MatchedPosition;
    
    my $text = <<"_TEXT_";
    01234567890
    abcdefghijklmn
    opqrstuvwxyz
    _TEXT_
    
    my $regex = qr/jk/;
    
    my $pos = Text::MatchedPosition->new(\$text, $regex);
    warn $pos->line, $pos->offset; # 2, 10

DESCRIPTION

Text::MatchedPosition is the module for finding the matched position in a text.

METHODS

new($text_ref || $text, $regex)

This is the constractor method.

line

return the count of line number. The beginning is 1;

If regex is no match, line to be undef.

offset

return the count of offset number. The beginning is 1;

If regex is no match, offset to be undef.

text

getter for text lines

regex

getter for regex

REPOSITORY

Text::MatchedPosition is hosted on github <http://github.com/bayashi/Text-MatchedPosition>

Welcome your patches and issues :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

LICENSE

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