How to obtain the URL and Chinese characters through regular expressions & lt; trclass = & quot; line & quot; & gt; & nbsp; & lt; tdalign = & quot; center & quot; & gt; [Fantasy Magic] & lt;/td & gt; & nbsp; & lt; td & gt; & lt; ahref = & quot; how can I obtain the URL and Chinese characters through regular expressions?
[Fantasy Magic]
Fight through the sky
Chapter 1 emperor Wudi
Silkworm potato
08-01
Serialization
1608
------ Solution --------------------
PHP code
// The question is not very clear. chinese characters? Is the content of Tag a or all Chinese characters? // Tag content processing $ str =' [Fantasy Magic] Fight through the sky Chapter 1 emperor Wudi Silkworm potato 08-01 Serialization 1608 '; Preg_match_all ('/(. *) <\/a>/isU ', $ str, $ matches); foreach ($ matches [1] as $ k => $ v) {echo $ v. '=> '. $ matches [2] [$ k].'
';}/** Output result: http://www.xiaoshuo5200.net/html/0/1/index.html=> fighting broken sky http://www.xiaoshuo5200.net/html/0/1/640748.html=> Chapter 1 five Emperor broken sky */
------ Solution --------------------
PHP code
[Fantasy Magic] Fight through the sky Chapter 1 emperor Wudi Silkworm potato 08-01 Serialization 1608 EOT; $ patten = '/
()? ([^ <>] *) (<\/A> )? <\/Td>/isU '; preg_match_all ($ patten, $ str, $ arr); echo"
";print_r($arr[3]);print_r($arr[5]);echo "
";