Php batch deletion of hyperlinks implementation method, php batch deletion of hyperlinks _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.