File_get_contents second wave! Regular Expression Matching is a great solution

Source: Internet
Author: User
File_get_contents second wave! Regular Expression Matching is very happy. The problem is that the content of file_get_contents is like this ..... & lt; spanclass = & quot; singer & quot; style = & quot; width: 95px; file_get_contents second wave! Regular Expression Matching is fun.
The problem is that the content of file_get_contents is as follows:

.....

Json

.....

Ajax

....

Php
/
Mysql


What I want to get is
PHP code
  array("json","ajax","php+mysql");


Regular expression is really a piece of pain in my mind .....

------ Solution --------------------
PHP code
$ S = <TXT... json... ajax... php/mysqlTXT; preg_match_all ("/------ solution --------------------
PHP code
 $s=<<
    
     (.*)<\/span>/isU',$s,$m);foreach($m[1] as $v){    $v=preg_replace('/<[^>]+>/','',$v,-1,$count);    if($count>2) $arr[]=join('+',preg_split("/[\r\n]+/",$v,-1,PREG_SPLIT_NO_EMPTY));    else              $arr[]=trim($v);    }print_r($arr);
    

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.