Voronich has asked for the wisdom of the Perl Monks concerning the following question:
Help me obi-several, you're my only hope.
I'm not confident I phrased that right in the title. But here 'goes. (I know this is out there but I don't have any hooks on what to call it to search.)
I have 2 strings:and I'm starting with something like:
/foo (\d+) bar (???)/My goal is to match the first string but not the second. I couldn't care less what the values are, merely whether or not they are equal.
I seem to recall it being possible (and perhaps fundamental) to match against "the string that matched grouping N".
But for the life of me I can't figure out how to do it, or what kind of keywords to search for to dig this up.
(please feel invited to edit this for clarity.)UPDATE: Damnit. My fault. There's an additional restriction. The regex itself is to be included in a fairly obtuse dispatch mechanism so the test needs to be constrained entirely to the matching of the expression. (does that make sense?)
Here's another wrinkle for the willing: Given that I can match easily enough with backrefs those two numbers, anyone know how to, again entirely within the scope of the regex match, return a POSITIVE match if the two numbers (both of \d+ format) do NOT match? (Yes, this is a practical independent real-world case. Ah, the joys of parsing log files in realtime.)
Thanks very much for your help (this article pushes me up to Monk! *SQUEE*)
-V
|
|---|