NAME

Term::Highlight - Perl module to highlight regexp patterns on terminals

SYNOPSIS

use Term::Highlight;
$obj = Term::Highlight->new( tagtype => $TAGTYPE );
$obj->LoadArgs( \@args );
$obj->LoadPatterns( \@ptns );
$obj->ClearPatterns( );
$obj->GetPatterns( );
$obj->Process( \$string );

Currently term and term-debug tagtypes are supported. If tagtype is term then boundaries of found patterns will be enclosed in ANSI terminal color escape sequence tags, if tagtype is term-debug then they will be marked by special symbolic sequences.

DESCRIPTION

Term::Highlight is a Perl module aimed to support highlighting of regexp patterns on color terminals. It supports 256 color terminals a well as older 8 color terminals.

EXPORTS

LoadPatterns

expects a reference to an array of references to arrays of type [ $pattern, $fg, $bold, $bg ]. Loads patterns to be processed.

ClearPatterns

clears the loaded patterns.

GetPatterns

returns a reference to the loaded patterns.

LoadArgs

expects an array of references to strings. Loads patterns to be processed. This is just a convenient version of LoadPatterns. Example of array to be loaded: [ "-46", "-25.1", "-i", "\bw.*?\b", "-100" ].

Process

expects a reference to a string. Makes substitution of color tags inside the string. Returns count of found matches.

SEE ALSO

hl(1)

AUTHOR

A. Radkov, <alexey.radkov@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008-2016 by A. Radkov.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.