I have the following html, i tried many many regex to remove hperlink content/text that is between ul tag and li tag only, but not found any regex for removing a tag text . I want that , whenever a tag comes under in ul and li tag then i want to replace a tag text with empty string.
<ul id="foot.dir" class="content" >
<li><a href="http://www.citysearch.com/aboutcitysearch/about_us" name="search_grid.footer.1.aboutCs" rel="nofollow" id="foot.dir.about">About</a></li>
<li><a href="http://www.citysearch.com/mobile-application" name="search_grid.footer.1.mobile" id="foot.dir.apps">Apps</a></li>
</ul>
i have tried this regex but it is not working, here input is string that contains html.
input = Regex.Replace(input, @"<ul[^>]*?><li><a[^>]*?>(?<option>.*?)</ul></li></a>", string.Empty);
Please help me out. Thank You
Regex is not a good choice for parsing HTML files..
HTML is not strict nor is it regular with its format..
Use htmlagilitypack
Regex is used for Regular expression
You can use this code to retrieve it using
HtmlAgilityPacki want to remove tag text using regex only ..