Text::MatchedPosition - find the matched position in a text
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
Text::MatchedPosition is the module for finding the matched position in a text.
This is the constractor method.
return the count of line number. The beginning is 1;
1
If regex is no match, line to be undef.
line
undef
return the count of offset number. The beginning is 1;
If regex is no match, offset to be undef.
offset
getter for text lines
getter for regex
Text::MatchedPosition is hosted on github <http://github.com/bayashi/Text-MatchedPosition>
Welcome your patches and issues :D
Dai Okabayashi <bayashi@cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Text::MatchedPosition, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::MatchedPosition
CPAN shell
perl -MCPAN -e shell install Text::MatchedPosition
For more information on module installation, please visit the detailed CPAN module installation guide.