Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: regex search valid only if registers n and n+1 are equal?

by TedPride (Priest)
on Jul 01, 2006 at 01:08 UTC ( [id://558713]=note: print w/replies, xml ) Need Help??


in reply to regex search valid only if registers n and n+1 are equal?

Why make things overly complicated?
while (<DATA>) { next if !m/foo (\d+) bar (\d+)/ || $1 != $2; print; } __DATA__ foo 1000 bar 1000 foo 1000 bar 500

Replies are listed 'Best First'.
Re^2: regex search valid only if registers n and n+1 are equal?
by ikegami (Patriarch) on Jul 01, 2006 at 04:21 UTC
    That can also be written using positive logic, as follows:
    while (<DATA>) { print if m/foo (\d+) bar (\d+)/ && $1 == $2; } __DATA__ foo 1000 bar 1000 foo 1000 bar 500

      Hello De Morgan's laws.

      Yes, I think you already knew what it is. This is for the other members of the audience.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-24 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found