Continue to ask for a php regular expression.

Source: Internet
Author: User
Continue to ask for a php regular expression. when you copy an article online, the following content is often included in the article.
(Www.xxx.com)
(Xxx network xxx.com)
(Www.xxx.cn)
(Www.xxx.net)
[Xxx www.xxx.com.cn]
[Xxx www.xxx.cn]
(Xxx network xxx.com)

The rule is that the website information is enclosed in Chinese () or [] or [], ", or English () [].
Most of the content is the URL

Beg for a regex that can delete these


Reply to discussion (solution)

$ S = <
  
  

Upstairs v5, respectable

$ S = <
     
    

$ S = <
       
      

$ S = <
         
        

Strong guy! However
In this way, the filter is marked as [], but some [] are normal content and are publicized by the website.
So, how can I filter the data based on the content such as [], including. com. cn. net?

$ S = <
           
          

Strong guy! However
In this way, the filter is marked as [], but some [] are normal content rather than advertisement information.
So, how can I filter the data based on the content such as [], including. com. cn. net?

$p=array(    "/(.+?(com|cn|net))/","/【.+?(com|cn|net)】/","/〖.+?(com|cn|net)〗/","/『.+?(com|cn|net)』/","/「.+?(com|cn|net)」/","/\[.+?(com|cn|net)\]/","/\(.+?(com|cn|net)\)/");

Try again, so it is better:

$p=array(    "/(.+?\.(com|cn|net))/","/【.+?\.(com|cn|net)】/","/〖.+?\.(com|cn|net)〗/","/『.+?\.(com|cn|net)』/","/「.+?\.(com|cn|net)」/","/\[.+?\.(com|cn|net)\]/","/\(.+?\.(com|cn|net)\)/");

Try again, so it is better:

$p=array(    "/(.+?\.(com|cn|net))/","/【.+?\.(com|cn|net)】/","/〖.+?\.(com|cn|net)〗/","/『.+?\.(com|cn|net)』/","/「.+?\.(com|cn|net)」/","/\[.+?\.(com|cn|net)\]/","/\(.+?\.(com|cn|net)\)/");


Thank you very much.
I would like to ask another question: how can I add another judgment url? the previous judgment is based on. com. cn and other suffixes, and how can I judge based on the prefix www.
Thank you again

Try again, so it is better:

$p=array(    "/(.+?\.(com|cn|net))/","/【.+?\.(com|cn|net)】/","/〖.+?\.(com|cn|net)〗/","/『.+?\.(com|cn|net)』/","/「.+?\.(com|cn|net)」/","/\[.+?\.(com|cn|net)\]/","/\(.+?\.(com|cn|net)\)/");


I would like to ask another question: how can I add another judgment url? the previous judgment is based on. com. cn and other suffixes, and how can I judge based on the prefix www.
Thank you again

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.