<?xml version="1.0" encoding="windows-1252"?>
<node id="354742" title="Re: Re: RE: Quantifiers in regular expressions" created="2004-05-19 16:25:14" updated="2005-07-19 21:56:59">
<type id="11">
note</type>
<author id="300037">
Roy Johnson</author>
<data>
<field name="doctext">
Putting a ? on a quantifier that isn't variable-length is like having any color car you want, as long as it's black. There's no difference between a greedy and a non-greedy &lt;code&gt;{5}&lt;/code&gt;.
&lt;P&gt;
A greedy quantifier will take as many characters as it can, and then start backtracking until whatever follows it matches. A non-greedy one will take as few characters as it can, and then take more until whatever is supposed to follow it is found.
&lt;div class="pmsig"&gt;
&lt;div class="pmsig-300037"&gt;
&lt;hr&gt;
&lt;small&gt;The PerlMonk &lt;tt&gt;tr///&lt;/tt&gt; Advocate&lt;/small&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
967</field>
<field name="parent_node">
354733</field>
</data>
</node>
