#!/usr/bin/perl


$regexp=$ARGV[0];
$page=$ARGV[1];
#if (open(PAGE, "lynx -dump '$page'|")) {
if (open(PAGE, "$page")) {
    local $/;
    $text=<PAGE>;
    $text =~ s@http://[a-zA-Z&_.:/0-9%?=,\#+()\[\]~-]*@@g;
    $text =~ s@\n@@g;
    $text =~ s@(Mr|Mrs)\.@\1POINT@g;
    @sentences=split /\./, $text;
    for (@sentences) {
         s@(Mr|Mrs)POINT@\1.@g;
        s/^\s*//;
        s/\s*$//;
        s/\[[0-9]+\]//g;
        s/\s+/ /g;
        print "$_.\n\n" if /\b$regexp\b/;
    }
}
