<p>I have a RegEx that is working for me but I don't know WHY it is working for me. I'll explain.</p>

<pre><code>RegEx: \s*&lt;in.*="(&lt;?.*?&gt;)"\s*/&gt;\s*
</code></pre>

<p><br>
Text it finds (it finds the white-space before and after the input tag):</p>

<pre><code>&lt;td class="style9"&gt;
      &lt;input name="guarantor4" id="guarantor4" size="50" type="text" tabindex="10" value="&lt;?php echo $data[guarantor4]; ?&gt;"  /&gt;    &lt;/td&gt;
&lt;/tr&gt;
</code></pre>

<p><br>The part I don't understand:</p>

<pre><code>&lt;in.*=" &lt;--- As I understand it, this should only find up to the first =" as in it should only find &lt;input name="

It actually finds: &lt;input name="guarantor4" id="guarantor4" size="50" type="text" tabindex="10" value=" which happened to be what I was trying to do.
</code></pre>

<p>What am I not understanding about this RegEx?</p>

```
.*
```
is greedy. You want
```
.*?
```
to find up to only the first
```
=
```
.