title: Turning a <input type=radio> into a <button> with Regex/C#
body: <p>Strange question, but I won't waste time explaining why I need to do this, just that I need to do it.</p>
  
  <p>I have the following:</p>
  
  <pre><code>&lt;input type="radio" name="eq_9" id="eq_9_2"  onclick="nextStepID_load(this);" value="Installer." title="912" /&gt;&lt;label for="eq_9_2"&gt;Installer&lt;/label&gt; &lt;br /&gt;
  </code></pre>
  
  <p>I need to turn that into:</p>
  
  <pre><code>&lt;button type="button" name="eq_9" id="eq_9_2" onclick="nextStepID_load('912');"&gt;Installer&lt;/button&gt;&lt;br /&gt;
  </code></pre>
  
  <p>I am using C#/asp.net (3.5 or below), and javascript for the performJS(which is a placeholder until I figure out how to replace the html).</p>
  
  <p>Please note, the source providing this is sending me a string with the MANY rows of the inputs. And I need to replace each row with the info that is valid for it.</p>
  
  <p>Right now, I've tried adding a .Replace("","\">"); which does replace the radio tags, but obviously makes it look horrible codewise, and doesn't remove the label or put the label contents in between the  tags.</p>
  
  <p>I'm sure this is probably best solved by a regex, but I'm not very familiar with regex. I have been toying with regexlib to see if I can figure out a regex on my own... here is what I have so far, although I imagine I'm pretty far off.</p>
  
  <pre><code>string strRegex = @"&lt;input type=""radio"" [\s]*=[\s]*""?[^\w_]*""?[^&gt;]*&gt;";
  RegexOptions myRegexOptions = RegexOptions.IgnoreCase | RegexOptions.Multiline;
  Regex myRegex = new Regex(strRegex, myRegexOptions);
  string strTargetString = @"&lt;input type=""radio"" name=""eq_9"" id=""eq_9_2""  onclick=""nextStepID_load(this);"" value=""Installer."" title=""912"" /&gt;&lt;label for=""eq_9_2""&gt;Installer&lt;/label&gt; &lt;br /&gt;";
  string strReplace = "&lt;button type="button"&gt;&lt;/button&gt;";
  return myRegex.Replace(strTargetString, strReplace);
  </code></pre>