links - Delete all href attribute in Wordpress posts

admin2025-06-02  3

i want to replace all links with plain text. So

<a href="">anchor text</a>

should be just

anchor text

So I tried regex and it works here but not in the plugin i used I tried this plugin /

Screenshot of Plugin

any idea how i can do this?

Update: just use

/<a[^>]*>(.*?)<\/a>/

i want to replace all links with plain text. So

<a href="http://www.anydomain/2">anchor text</a>

should be just

anchor text

So I tried regex and it works here https://regex101/r/4q4nPf/1 but not in the plugin i used I tried this plugin https://wordpress/plugins/search-regex/

Screenshot of Plugin

any idea how i can do this?

Update: just use

/<a[^>]*>(.*?)<\/a>/
Share Improve this question edited Feb 22, 2019 at 9:05 Simon Schmid asked Feb 21, 2019 at 21:11 Simon SchmidSimon Schmid 11 bronze badge 1
  • Did you try adding a delimiter around your regex pattern? That's what the little note on the bottom of your screenshot says. So for instance, /<a[^>]*>(.*?)<\/a>/ , noting the added slashes. (Since this is replacing stuff in your database, let me say, use at your own risk.) – tmdesigned Commented Feb 21, 2019 at 22:45
Add a comment  | 

1 Answer 1

Reset to default 1

Moving comment to answer:

Did you try adding a delimiter around your regex pattern? That's what the little note on the bottom of your screenshot says. So for instance, /]>(.?)</a>/ , noting the added slashes. (Since this is replacing stuff in your database, let me say, use at your own risk.)

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748877081a314462.html

最新回复(0)