-
Need Regex
I need to remove the tag which has class value "footer_1". i struck with writing regex for this.
Example.
input :
Code:
<body>
<a name="t1" id="pg-14-0"></a>
<p id="pg-14-1">1<span class="chapter-body_13" id="pg-14-2">C H A P T E R</span></p>
<p id="pg-14-3" class="footer_1">Why self-build, and why build green?</p>
<a id="pg-14-3" class="footer_1">Why self-build, and why build green?</a>
<p id="pg-14-4" class="chapter-body_15">Building your own home can be a very satisfying thing to do, and many people have gained a great sense of achievement from doing it..</p>
</body>
output:
Code:
<body>
<a name="t1" id="pg-14-0"></a>
<p id="pg-14-1">1<span class="chapter-body_13" id="pg-14-2">C H A P T E R</span></p>
<p id="pg-14-4" class="chapter-body_15">Building your own home can be a very satisfying thing to do, and many people have gained a great sense of achievement from doing it..</p>
</body>
:thumb:
-
Re: Need Regex
Hey,
Whenever it comes to parsing an HTML string, I always recommend the HTML Agility Pack:
http://htmlagilitypack.codeplex.com/
It does a lot of the hard work of working with the HTML string for you, meaning that you don't have to create the regex yourself.
Hope that helps!
Gary