Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Regular expressions across multiple lines

by Anonymous Monk
on Apr 24, 2016 at 20:58 UTC ( [id://1161397]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1161397]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found