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

Re: force regular expression to match every item only once

by pKai (Priest)
on Apr 20, 2008 at 20:03 UTC ( #681825=note: print w/ replies, xml ) Need Help??


in reply to force regular expression to match every item only once

I'm not exactly sure what you want to achieve, but from what I read I would think you want matching pairs in $matcher instead of zero-length assertions, as in:

my $matcher = qr/(?:(@{[join "|", @pairs]}))/;

Which gives 3 matches instead of 5 (likewise for $dictword = "zeezze";.)

If I' completely wrong, please clean the syntax/stricture errors in your OP first.


Comment on Re: force regular expression to match every item only once
Select or Download Code
Re^2: force regular expression to match every item only once
by hiddenOx (Novice) on Apr 21, 2008 at 02:42 UTC
    I've updated the code and the current one is compiling right, sorry but didn't have much sleep. The problem still exist actually as I want it when it when one pair get matched once, it can't get matched again so for the current one, it should give only score 2 (ze and ez gets matched once each) and not 4 where it match each pair twice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2015-07-04 15:02 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 (60 votes), past polls