in reply to Lookaround Assertions

How about using substr to look only in a window around the copyright text, something like (not tested)

my $pos; if ( $string =~ m{(?=.*\Wcopyright(\W|ed\W)|\s\(c\)\s)} ) { $pos = pos( $string ) - 200; $pos = 0 if $pos < 0; } else { warn qq{Copyright text not found\n}; next; # or whatever } my $date = $1 if substr( $string, $pos, 400 ) =~ m{\D((?:19|20)\d\d)\D};

I hope this is useful.

Cheers,

JohnGG

Update: Corrected warning line, I'd mixed double quotes and a qq{...} quoting construct :-/