Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 studying the Monastery: (11)
As of 2014-10-02 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (57 votes), past polls