Neil Thompson
asked on
after some regex that I can run in textpad or similar to remove all <a href tage from text
Hi
I have 150 pages that I need to remove all the links from (APART FROM ANCHOR TAGS <a name...) so I intend to open them in textpad and clear via some kind of regex
I want to keep the text that was in the links though so for example
<a href="test/test.htm">this is a test</a> would become simply this is a test
<a name="test"></a> would remain intact.
Points for full working regex please
Regards
Neil
I have 150 pages that I need to remove all the links from (APART FROM ANCHOR TAGS <a name...) so I intend to open them in textpad and clear via some kind of regex
I want to keep the text that was in the links though so for example
<a href="test/test.htm">this is a test</a> would become simply this is a test
<a name="test"></a> would remain intact.
Points for full working regex please
Regards
Neil
I don't have textpad to test what will work with that, but in regexr this seems to work:
(?=<a[^>]+href)<a[^<>]*?>(.*?)</a>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
P.S.
I run TP with POSIX regular expression syntax enabled. If the above doesn't work for you, you can enable this option by going to Configure--Preferences--Ed itor--Use POSIX regular expression syntax.
untitled.PNG
I run TP with POSIX regular expression syntax enabled. If the above doesn't work for you, you can enable this option by going to Configure--Preferences--Ed
untitled.PNG
My attempt wasn't too good.
kaufmed: does your's strip the </a> tags? (mine didn't)
kaufmed: does your's strip the </a> tags? (mine didn't)
Negative.
ASKER
Excellent, many thanks
Neil
Neil
NP. Glad to help = )
Open in new window