Term::Highlight - Perl module to highlight regexp patterns on terminals
Term::Highlight is a Perl module aimed to support highlighting of regexp patterns in color terminals. It supports 256 color terminals a well as older 8 color terminals.
sets type of color tags. Only term and term-debug tag types are currently 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: this is supposed to use for debug purposes.
term
term-debug
defines how to treat newlines in input lines. Set this to non-zero value if input lines do not contain newlines: this will gain a bit of speed.
expects a reference to an array of references to arrays of type [ $pattern, $fg, $bold, $bg ]. Loads patterns to be processed.
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" ].
LoadPatterns
returns a reference to the loaded patterns.
clears the loaded patterns.
expects a reference to a string. Makes substitution of color tags inside the string. Returns count of found matches.
hl(1)
A. Radkov, <alexey.radkov@gmail.com>
Copyright (C) 2008-2023 by A. Radkov.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Term::Highlight, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::Highlight
CPAN shell
perl -MCPAN -e shell install Term::Highlight
For more information on module installation, please visit the detailed CPAN module installation guide.