[Solved] Perl search term [closed]


The following should work…

$str = "sdfcatsdfdogffdfcatsdfjljlfflkfjflkjfdogsfsd";
@arr = $str =~ /(cat).{0,10}dog/sgi;
print join(',', @arr), "\n";

s to match over newlines, g to extract all matched instances, and i to ignore case.

I’m not sure what you mean by ‘within 13’, but I’ve assumed here that as many as 10 characters can separate the ‘t’ in cat from the ‘d’ in dog.

solved Perl search term [closed]