Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Patter Finding

by japhy (Canon)
on Sep 11, 2001 at 05:09 UTC ( [id://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:??;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-16 22:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found