Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Regex matching on grid alignment

by LanX (Saint)
on Sep 08, 2013 at 22:42 UTC ( [id://1052932]=note: print w/replies, xml ) Need Help??


in reply to Regex matching on grid alignment

DB<130> $a='ABCBBBCBADBCCACDDDAC' => "ABCBBBCBADBCCACDDDAC" DB<131> grep { /(.)\1\1/ } unpack '(A5)4', $a => "DDDAC"

edit

unpack pattern shortened

Cheers Rolf

( addicted to the Perl Programming Language)

update

IMHO its also possible to include the same principle into one regex (matching groups of 5 characters and investigating each match with embedded Perl) but I doubt it's more readable.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-03-28 09:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found