<?xml version="1.0" encoding="windows-1252"?>
<node id="899823" title="Re^4: grep trouble (body of flip-flop range)" created="2011-04-17 12:21:50" updated="2011-04-17 12:21:50">
<type id="11">
note</type>
<author id="708738">
LanX</author>
<data>
<field name="doctext">
Thanks!&lt;P&gt;

IMHO sounds like far less than 1‰ of all CPAN modules might rely on this.&lt;P&gt;

&lt;hr&gt;UPDATE:&lt;P&gt;

OK found another use-case, I just recently had the need in my [id://898097|ORG-Parser] to distinguish the range delimiters and the range "body" with a flip-flop-operator, like for ORG's "BEGIN/END"-blocks.&lt;P&gt;

 This can be simplified (i.e. more DRY), if one has access to the last successful pattern:&lt;P&gt;

&lt;c&gt;
  DB&lt;114&gt; for(0..99) {print if (/10/../20/ and not //)}
111213141516171819
  DB&lt;115&gt; for(0..99) {print if (/10/../20/)}
1011121314151617181920
  DB&lt;116&gt; for(0..99) {print if (/10/../20/ and //)}
1020
&lt;/c&gt;&lt;P&gt;

I think that's a more frequent application, I even slightly remember seeing it in Friedl's book.&lt;P&gt;

But I'd rather prefer an explicit special varą, something  like &lt;c&gt;$PATTERN&lt;/c&gt; or &lt;c&gt;$&amp;&amp;&lt;/c&gt; (in analogy to &lt;c&gt;$MATCH&lt;/c&gt; resp. &lt;c&gt;$&amp;&lt;/c&gt;) .&lt;P&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-708738"&gt;
&lt;p&gt;Cheers Rolf
&lt;/div&gt;&lt;/div&gt;&lt;P&gt;

1) an special var has the advantage that the regex itself can be accessed, e.g. printed. </field>
<field name="root_node">
899784</field>
<field name="parent_node">
899822</field>
</data>
</node>
