I want to filter out p tag with a class from the HTML below, while not affecting any other p tags following it.
<article data-article-content>
<div class="abc">
<p class="ghf">Some Text</p>
<p>Some other Text</p>
<p>A different Text</p>
</div>
</article>
What I am using:
def myFunction(result):
result = re.sub(r'<article data-article-content><div class="abc"><p class="ghf">.*?</p><\/article>',' ',result)
return result
I will call this function and printing that out should omit 'Some Text'. I am a beginner in regex. Please help with suggestions
Expected Output:
Some other Text A different Text
` nodes, not just the first one. Could you please [edit] to clarify what the expected result should be?
– tripleee Oct 25 '21 at 20:04