Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Patter Finding

by japhy (Canon)
on Sep 11, 2001 at 05:09 UTC ( #111641=note: print w/ replies, xml ) Need Help??


in reply to Pattern Finding

This works... but probably only on account of villany. I think for something to be considered a "pattern", it has to show up TWICE, not just once.

$_ = "helloworldhellohellohihellohiworld"; m{ (?{ local ($c1, $c2, $c3) = (0,0,0) }) ^ (.+?) (?: \1 (?{ local $c1 = $c1 + 1 }) )* (.+?) (?: (?: \1 (?{ local $c1 = $c1 + 1 }) ) | (?: \2 (?{ local $c2 = $c2 + 1 }) ) )* (.+?) (?: (?: \1 (?{ local $c1 = $c1 + 1 }) ) | (?: \2 (?{ local $c2 = $c2 + 1 }) ) | (?: \3 (?{ local $c3 = $c3 + 1 }) ) )* (?(?{ $c1 && $c2 && $c3 })|(?!)) $ }x and print "<$1> <$2> <$3>\n";

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;


Comment on Re: Patter Finding
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-07-31 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls