Extract a particular div from string
<p>suppose a huge text data is stored in string variable like</p>

<pre><code>&lt;form method="post" action="../Dialog.aspx" id="ctl00"&gt;
    &lt;div class="aspNetHidden"&gt;
        &lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUBMGRkcTeMEXjXlquwdmAmnkFVfUymwaaSdYr/CV1hV+mxr6A=" /&gt;
&lt;/div&gt;


&lt;div id="frm"&gt;
    &lt;table class="form" border="0"  cellpadding="0"&gt;
        &lt;tr&gt;
            &lt;td class="labeltag"&gt;Name:&lt;/td&gt;
            &lt;td class="inputtd"&gt;
                &lt;input name="ctl01$txtName" type="text" maxlength="100" id="ctl01_txtName" class="inputfield" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class="labeltag"&gt;Subject:&lt;/td&gt;
            &lt;td class="inputtd"&gt;
                 &lt;input name="ctl01$txtSubjectject" type="text" maxlength="100" id="ctl01_txtSubjectject" class="inputfield" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class="labeltag"&gt;Email:&lt;/td&gt;
            &lt;td class="inputtd"&gt;
                &lt;input name="ctl01$txtEmail" type="text" maxlength="100" id="ctl01_txtEmail" class="inputfield" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class="textfield" colspan="2"&gt;
                Message:
                &lt;div class="messagefield"&gt;
                    &lt;textarea name="ctl01$txtmessage" rows="7" cols="33" id="ctl01_txtmessage" class="message"&gt;
                    &lt;/textarea&gt;
                &lt;/div&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td colspan="2"&gt;
                &lt;input type="submit" name="ctl01$btnSubmit" value="Submit" id="ctl01_btnSubmit" class="button" /&gt;
                &lt;input type="submit" name="ctl01$btnCancel" value="Cancel" id="ctl01_btnCancel" class="button" /&gt;
        &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td colspan="2" style="height:10px"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td colspan="2"&gt;
                &lt;div class="bottomline" id="loader"&gt;

                &lt;/div&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt;
&lt;div class="aspNetHidden"&gt;
    &lt;input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBwKni+1oAuj1kf0MAoWeuckCAqCHyBsC34bOwQQC1cvcnQsC67K1+giML7QhoV19G+plAUvDQ7ade0566ipNfJ+BXR02JW5IIQ==" /&gt;
&lt;/div&gt;
</code></pre>

<p></p>

<p>from the above data i just need to extract a particlular div having is called "frm" .</p>

<p>so the whole div and its content will be extracted. i know this can be done with regex but i dont know which patter will work in my case. </p>

<p>i use the code to extract a particular div like</p>

<pre><code> Regex search_string = new Regex("&lt;div.*?id=\"frm\".*?&gt;.*&lt;/div&gt;");
        Match match = search_string.Match(outputToReturn);
        string section = match.Groups[0].Value;
</code></pre>

<p>but section has nothing....match not found. so how to do it.
so please help. thanks</p>
