Dai Okabayashi > Text-MatchedPosition-0.02 > Text::MatchedPosition

Download:
Text-MatchedPosition-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: Text-MatchedPosition-0.03

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.

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.

syntax highlighting: