Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: finding number of contiguous letters

by GrandFather (Sage)
on May 23, 2007 at 04:57 UTC ( #616932=note: print w/replies, xml ) Need Help??


in reply to finding number of contiguous letters

use strict; use warnings; my $str = "computer"; my @parts = $str =~ /(?=(...))/g; print "@parts";

Prints:

com omp mpu put ute ter

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: finding number of contiguous letters
by Marknel (Acolyte) on May 23, 2007 at 05:15 UTC
    thank you.
    I'm trying to understand what the ?= is in the match. off to search perl docs!

      I forgot about some of the fancier Perl RegEx stuff too. ?= is about a third of the way down the page && does positive lookahead. RegExes are so damn wonderfully powerful.

      I'm really enjoying this sweet simple thread. Thanks to all contributors. =)

      Maybe a giant benchmark could be made of every single version. I haven't messed with Benchmark stuff much but it's obviously super-useful too. I'd like to grok it && incorporate it into my Perl practices. Hasta.

      -Pip

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2020-10-21 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (223 votes). Check out past polls.

    Notices?