$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>links - Delete all href attribute in Wordpress posts|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

links - Delete all href attribute in Wordpress posts

matteradmin7PV0评论

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.)

Post a comment

comment list (0)

  1. No comments so far