title: Regular Expression for search in html
body: <p>I' m trying to write correct regex for searching value in html, but have some problems.</p>
  
  <p>There is a piece of html:</p>
  
  <pre><code>&lt;div class="inner"&gt;
  &lt;div class="title"&gt;Processing 3-D Secure Transaction&lt;/div&gt;
  &lt;form autocomplete="off" name="PAResForm" id="PAResForm" action="https://www.alfaportal.ru/" method="POST"&gt;
  &lt;input name="MD" type="hidden" value="4326381105C3B67B2823E71FD235FFD2"&gt;&lt;input value="eJzVWFmvo0iy/iulnkerm9UYt1xdQtJ2pkQdOVw5AW2qGv+is66Q
  qrz9LBZ3mCe7mJzYARdloC1dJ/Lk+nQ7KBxxdgtIEgy/Tp/I93MZ5NtZzfdTnPdj5vfz7tex6I/n
  4P8DRkGf4Q==" name="PaRes" type="hidden"&gt; 
  </code></pre>
  
  <p>I'm trying to search string </p>
  
  <pre><code>&lt;input name="MD" type="hidden" value="4326381105C3B67B2823E71FD235FFD2"&gt;
  </code></pre>
  
  <p>and get value</p>
  
  <p>The problem is value and name can replace each other
  For example</p>
  
  <pre><code>&lt;input value="4326381105C3B67B2823E71FD235FFD2" type="hidden" name="MD"&gt;
  </code></pre>
  
  <p>I wrote regex pattern:</p>
  
  <pre><code>&lt;input.*name=\"MD\"|value=\"([^&lt;&gt;]*?)\"[^&lt;&gt;]*value=\"([^&lt;&gt;]*?)\"|name=\"MD\".*?&gt;
  </code></pre>
  
  <p>it works in some online regex services, but does not work in real java.</p>
  
  <p>Help please to modify it correctly.</p>
  
  <p>Also I wrote simple command-line tool for testing it. <a href="http://pastebin.com/Pzynqrn8" rel="nofollow">http://pastebin.com/Pzynqrn8</a></p>