in reply to Re: Searching for a word that may only exist in part
in thread Searching for a word that may only exist in part

For:

my $sequence = "111...1111...11"; my $find = "11111";

Prints:

found? 1111

whereas the OP says "if I do not find the whole word within a sequence and start truncating the word, then it can only match at either end of a sequence and not within".


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^3: Searching for a word that may only exist in part
by mreece (Friar) on Oct 19, 2006 at 02:40 UTC
    oh, i misunderstood, thinking only at the beginning or end of the 'find' sequence (1111 is the beginning (..and end..) of 11111).

    the regexes are fixable (/(^$tail|$tail$)/ and same for $head?) easily enough.. i just wanted an excuse to use chop ;-)