in reply to Regular expressions across multiple lines

#!/usr/bin/perl use strict; use warnings; tr/\r\n//d for my $string = do { local $/; <> }; # slurp STDIN printf "leader %s middle %s trailer %s\n", $1, $2, $3 while $string =~ /(?<=(.....))CCCC(.{10})AGA(?=(.....))/g;

Replies are listed 'Best First'.
Re^2: Regular expressions across multiple lines
by Anonymous Monk on Apr 24, 2016 at 22:10 UTC

    On thinking about it, replace

    tr/\r\n//d

    with

    tr/ACGT//cd

    and keep exactly what you want.

Re^2: Regular expressions across multiple lines
by Anonymous Monk on Apr 24, 2016 at 22:57 UTC

    perl scans through a 420mb test case in 1.17 seconds. Cool.