The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::FastSearch - Fast string search library.

SYNOPSIS

    use Text::FastSearch;

    @offsets = search_string ($pattern, $text);
    $offset = strindex ($pattern, $text);
    @offsets = search_file ($pattern, $filename);
   

DESCRIPTION

Search_string () searches for exact matches of a string within another string, without performing regular expression pattern matching. Strindex () searches for the first occurence of an exact pattern within the text. Search_file () searches a file for occurrences of the exact text in the file.

In a list context, search_string () and search_file () return a list of file offsets where the pattern occurs in the search text, or a reference to the list of offsets in scalar context. Strindex () returns the offset of the first occurence of the pattern in the text. The subroutines return undef if the search pattern is not found.

EXPORTS

strindex (pattern, text)

Returns the offset of the first occurence of pattern in text, or undef if pattern is not found.

search_string (pattern, text)

Returns a list of offsets in text where pattern is found, or undef.

search_file (pattern, file_name)

Returns a list of offsets in the input file where pattern is found, or undef.

VERSION AND CREDITS

$Id: FastSearch.pm,v 1.2 2006/04/28 08:03:35 kiesling Exp $

Copyright © 2005-2006 Robert Kiesling, rkies@cpan.org.

Licensed under the same terms as Perl. Refer to the file, "Artistic," for details.

The search strategies are from the Boyer-Moore search algorithm as described in Michael Abrash's Graphics Programming Black Book.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 117:

Non-ASCII character seen before =encoding in '©'. Assuming CP1252