I know there are several similar questions already asked. But can't fix this issue with regex.
In any post where I have header like
<h1><a href="#hello">link text</a>Title with header tag </h1>
<h2><a href="http://so.com">link text</a>Title with header tag</h2>
I tried to remove anchor tag from header tag with anchor tag link and text. but not header tag title.
here is my regex which removes my title text also.
(<h[1-2].*?>)<a.*?>
And
(<h([1-6])[^>]*>)\s?<a>(.*)?<\/a>\s?(<\/h\2>)
Here is URL
My final result will be like.
<h1>Title with header tag </h1>
<h2>Title with header tag</h2>
` and `
– Aaron K. Sep 08 '17 at 16:01`?
or
– Дтдця Sep 08 '17 at 16:54tag
Title with header tag
` – Дтдця Sep 08 '17 at 16:59