Find a regular expression!!!!!!!

Source: Internet
Author: User
Regular expressions

Http://bbs.10jqka.com.cn/codelist.html
Get some of the above links
There are three kinds of Shenzhen, Shanghai stock and fund
What I need to get is the stock name and stock code

For example:
  • Pudong Hair Bank 600000

  • Baiyun Airport 600004


  • Get results
    Pudong Hair Bank 600000
    Baiyun Airport 600004

    Can be directly obtained into
    $a =array ("600000" and "pu FA Bank")
    It's better to have an array like this.

    First of all, thank you, big God.


    Reply to discussion (solution)

    Preg_match_all ('/
  • ]+> (. +) <\/a><\/li>/isu ', $s, $m);p rint_r ($m [1]);
  • $str =<<
     <>
  • Pudong Hair 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) = $a;p rint_r ($o);
  •  
      ]+> ([^\d]+) (\d{6}) <\/a><\/li>/isu ', $str, $match); $a = Array_combine (Array_values ($match [2]), Array_ VALUES ($match [1]);p rint_r ($a);

     
      ]+> ([^\d]+) (\d{6}) <\/a><\/li>/isu ', $str, $match); $a = Array_combine (Array_values ($match [2]), Array_ VALUES ($match [1]);p rint_r ($a);



    Thanks, you can use this.
    Can you tell me how to turn the generated array from GBK to UTF8?
    I tried a few of them and failed.

    $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 ($a);

    $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 ($a);
    Thanks, you can.

    $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 ($a);
    Ask next, how to put a $ A array inside the subscript prefix to save the 0,3,6, the rest of the to clear out
    Is there any easy way?

    That is, as long as the Shenzhen and SSE data, the Fund's not

    Preg_match_all ('/

  • ]+> ([^\d]+) (\d{6}) <\/a><\/li>/isu ', $str, $match);
    Switch
    Preg_match_all ('/
  • ]+> ([^\d]+) ([036]\d{5}) <\/a><\/li>/isu ', $str, $match);

    Preg_match_all ('/

  • ]+> ([^\d]+) (\d{6}) <\/a><\/li>/isu ', $str, $match);
    Switch
    Preg_match_all ('/
  • ]+> ([^\d]+) ([036]\d{5}) <\/a><\/li>/isu ', $str, $match);
    Thank you greatly
  • 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.