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 600000Baiyun airport 600004STR;
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 ($ );