Returns a regular expression! What should I do?

Source: Internet
Author: User
Find a regular expression !!!!!!! Bbs.10jqka.com.cncodelist.html to obtain some of the above links: Shenzhen, Shanghai, and Shanghai. I need to obtain the stock name and code, for example, & nbsp; & lt; li & gt; & lt; a & nbsp; hrefbbs.10jqka.com. cnsh, 600000,1 & nbsp; t calculate a regular expression !!!!!!!
Http://bbs.10jqka.com.cn/codelist.html
Obtain some content in the above link
There are three types of funds: Shenzhen, Shanghai, and Shanghai.
What I need to obtain is the stock name and stock code.

For example:
  • Pudong Development Bank 600000

  • Baiyun airport 600004


  • Obtain results
    Pudong Development Bank 600000
    Baiyun airport 600004

    Can be directly obtained
    $ A = array ("600000" => "Pudong Development Bank ")
    This array is better.

    Thank you!

    Regular expression

    Share to: <... 'data-pics = ''>


    ------ Solution --------------------
    preg_match_all('/
  • ]+>(.+)<\/a><\/li>/isU',$s,$m);
    print_r($m[1]);

  • ------ Solution --------------------

    $ Str = <
  • Pudong Development Bank 600000

  • Baiyun airport 600004

  • STR;

    Preg_match_all ("/(\ S +) \ s + (\ d +)/", preg_replace ("/<\/? [^>] +?> /",'', $ Str), $ out, PREG_SET_ORDER );

    Foreach ($ out as $ a) list ($ s, $ o [$ I], $ I) = $;
    Print_r ($ o );


    ------ Solution --------------------
     $url ="http://bbs.10jqka.com.cn/codelist.html";
    $str = file_get_contents($url);
    preg_match_all('/
  • ]+>([^\d]+)(\d{6})<\/a><\/li>/isU',$str,$match);
    $a = array_combine(array_values($match[2]),array_values($match[1]));
    print_r($a);


  • ------ Solution --------------------
    $ Url = "http://bbs.10jqka.com.cn/codelist.html ";
    $ Str = file_get_contents ($ url );
    $ Str = iconv ('gbk', 'utf-8', $ str );
    Preg_match_all ('/
  • ] +> ([^ \ D] +) (\ d {6}) <\/a> <\/li>/isU ', $ str, $ match );
    $ A = array_combine (array_values ($ match [2]), array_values ($ match [1]);
    Print_r ($ );

  • 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.