The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Search::Tools::RegExp::Keyword - access regular expressions for a keyword

SYNOPSIS

 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";
    }
 }
 
 

DESCRIPTION

Search::Tools::RegExp::Keyword provides access to the regular expressions for a query keyword.

METHODS

new

Create an object. Used internally.

word

Returns the original keyword on which the regular expressions are based.

phrase

Returns true if the keyword was treated as a phrase.

plain

Returns a regular expression for matching the keyword in a plain text (no HTML or XML markup).

html

Returns a regular expression for matching the keyword in a HTML or XML text.

AUTHOR

Peter Karman 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.

COPYRIGHT

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.

SEE ALSO

HTML::HiLiter, Search::Tools::RegExp, Search::Tools::RegExp::Keywords