<?xml version="1.0" encoding="windows-1252"?>
<node id="996753" title="Re^2: How to use &quot;less than&quot; and &quot;greater than&quot; inside a regex for a $variable number" created="2012-10-01 17:28:58" updated="2012-10-01 17:28:58">
<type id="11">
note</type>
<author id="644375">
Polyglot</author>
<data>
<field name="doctext">
I appreciate the link, but that resource only tells how to work with a known quantity.  I need to be able to match a variable number, conditional upon its relative value when compared to another number.  In essence, I need to match based on the comparison result.
&lt;p&gt;
For example, how would one do something like this?
&lt;code&gt;
$string = "I have 5 apples, 6 oranges, and 8 limes.";

#Match the oranges only if they are more than the apples
#and fewer than the limes.
$string =~ m/(\d+)\sapples.*(\d+)\soranges.*(\d+)\slimes(?{if (($1&lt;$2) &amp;&amp; ($2&lt;$3))})/g;
&lt;/code&gt;
If I had something like that I could then plug in $var for $2.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-644375"&gt;
&lt;p&gt;Blessings,
&lt;p&gt;&lt;i&gt;~Polyglot~&lt;/i&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
996728</field>
<field name="parent_node">
996746</field>
</data>
</node>
