Here is another script that will search for a given sequence at a given spacing. It can be applied to any text, without requiring it to be stripped first. The assumption here is that spacing and punctuation will be ignored.
#!/usr/bin/perl use strict; use warnings; my ($message, $spacing); if ($#ARGV >= 1) { $message = shift; $spacing = shift; } else { die "Usage: els_find.pl message spacing files\n"; } $spacing > 0 or die "Spacing must be greater than zero\n"; # Build a pattern that will recognize the message in regular # text, ignoring punctuation and spacing. my @letters = split //,$message; my $pattern = join("(?:[^a-z]*[a-z]){$spacing}",@letters); my $re = qr/($pattern)/i; # Allow minimal wrapping across lines without having to slurp # the whole file. $/ = ''; # paragraph mode while (<>) { chomp; if ($_ =~ $re) { print "Matched: *$1* at paragraph $. of file $ARGV\n"; } }

In reply to Re: Mystery Novelist seeks ELS generator by tall_man
in thread Mystery Novelist seeks ELS generator by dimar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":