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