Search::Tools::RegExp::Keyword - access regular expressions for a keyword
my $regexp = Search::Tools::RegExp->new(); my $kw = $regexp->build('the quick brown fox'); for my $w ($kw->keywords) { my $re = $kw->re( $w ); # $re is S::T::R::Keyword object # each of these are regular expressions ... suitable for framing my $h = $re->html; my $p = $re->plain; unless ( $re->word =~ m/^$h$/ ) { die "something terribly wrong with the html regexp: $h"; } unless ( $re->word =~ m/^$p$/ ) { die "something terribly wrong with the plain regexp: $p"; } }
Search::Tools::RegExp::Keyword provides access to the regular expressions for a query keyword.
Create an object. Used internally.
Returns the original keyword on which the regular expressions are based.
Returns true if the keyword was treated as a phrase.
Returns a regular expression for matching the keyword in a plain text (no HTML or XML markup).
Returns a regular expression for matching the keyword in a HTML or XML text.
Peter Karman perl@peknet.com
perl@peknet.com
Based on the HTML::HiLiter regular expression building code, originally by the same author, copyright 2004 by Cray Inc.
Thanks to Atomic Learning www.atomiclearning.com for sponsoring the development of this module.
www.atomiclearning.com
Copyright 2006 by Peter Karman. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
HTML::HiLiter, Search::Tools::RegExp, Search::Tools::RegExp::Keywords
To install Search::Tools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Tools
CPAN shell
perl -MCPAN -e shell install Search::Tools
For more information on module installation, please visit the detailed CPAN module installation guide.