Php regular expression replacement

Source: Internet
Author: User
Php regular expression replacement
// 1. how to remove the "number" and the adjacent tag pair? remove this part in the following code:

There are many other characters, forms, and so on... there are many other characters, forms, and so on.

$ Content = "0000

111

222

There are many other characters, forms, and so on... there are many other characters, forms, and so on.

222

111

0000 "; // your image $ content =''; // $ content = preg_replace ('// is', '', $ content); var_dump ($ content );


Reply to discussion (solution)

1. echo preg_replace ('/<[^>] +> [^ <>] * [^ <>] * <[^>] +>/U ', '', $ content); 2, $ content = preg_replace ('/] +) src = [" \'] http [s]? : \ // Www \. aabbcc \. com \/upload \/qrcode_for_gh_2ff16e7c9789_258 \. jpg ["\ '] (. *?)> /Is ', '', $ content );

Moderator

1. echo preg_replace ('/<[^>] +> [^ <>] * [^ <>] * <[^>] +>/U ', '', $ content); 2, $ content = preg_replace ('/] +) src = [" \'] http [s]? : \ // Www \. aabbcc \. com \/upload \/qrcode_for_gh_2ff16e7c9789_258 \. jpg ["\ '] (. *?)> /Is ', '', $ content );



The result is empty...

Which one is empty?

Which one is empty?


$ Content = "0000

111

222

There are many other characters, forms, and so on... there are many other characters, forms, and so on.

222

111

0000 "; $ content = preg_replace ('/<[^>] +> [^ <>] * [^ <>] * <[^>] +> /', '', $ content); // remove the modifier.

Which one is empty?


Scan the QR code or search for the mcq28tui.


<[^>] +> [^ <>] * [^ <>] * <[^>] +> The matched result is
Or directly search for the number:
How does one match the span tag (the closest tag to the ID )?

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.