Php batch deletion hyperlink implementation method, php batch deletion hyperlink. Php batch deletion of hyperlinks implementation method, php batch deletion of hyperlinks to clear a section of html text hyperlinks the most common syntax can be: Copy the code as follows: $ strpr php implementation of batch deletion of hyperlinks, php batch deletion of hyperlinks
The most common way to clear a hyperlink in html text is as follows:
The code is as follows: $ str = preg_replace ("/] * href = [^>] *> | <\/[^ a] * a [^>] *>/I ", "", $ content );
1. delete hyperlinks in html text
The code is as follows: ereg_replace ("] *> | <\/a>", "", $ content );
2. clear hyperlinks containing specified keywords
$ Find = "this string is my find"; $ string = 'content to be replaced with '; // echo ereg_replace ('] *)> ([^ <] * '. $ find. '[^>] *)', '\ 2', $ content );
The following are several methods to obtain the text content of hyperlinks in html text:
// Method 1 preg_match_all ('/<(a | a) [s] {0, 1} [w = ":()] *> [nrn] * (check user) [nrn] *
/I ', $ string, $ matches); // method 2 preg_match_all ('/check user/I ', $ string, $ matches); print_r ($ matches ); // method 3 preg_match_all ('/] *> [^ <] */I', $ string, $ matches); print_r ($ matches ); // method 4 preg_match_all ('/check user/is', $ str, $ arr); print_r ($ arr );
The above are four methods for php to batch delete hyperlinks. I hope this will be helpful for your learning.
The most common way to clear a hyperlink in html text is as follows: $ str = pr...