Chengdu E-Commerce Co., Ltd. Rosie 5101220001248473770103 Chengdu Science and Technology Co., Ltd. Huang can hair 5110400017076766531815
PHP Novice
Ask PHP to extract the two parameters in the Javascript:detail (' R2013031500000871 ', ' 671529939 ') and the values in TD with regular,
A TR for a row, preferably into an array, thank you.
Reply to discussion (solution)
$s =<<
Chengdu E-Commerce Co., Ltd.Rosie5101220001248473770103 Chengdu Branch Technology Co., Ltd.Huang can hair5110400017076766531815 Txt;preg_match_all ('/
]+> (. +) <\/td>/su ', $s, $m);p rint_r ($m [1]); TD Value Preg_match_all ('/
Oh, there's one less print parameter.
Preg_match_all ('/Print_r ($ar [1]); Parameter 1
Print_r ($ar [2]); Parameter 2
Oh, there's one less print parameter.
Preg_match_all ('/Print_r ($ar [1]); Parameter 1
Print_r ($ar [2]); Parameter 2
A TR is a line, because the actual case of TR may be multiple lines, I would like to be a TR to match, take out each line TR TD value is an array.
Preg_match_all ('/
]+>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/ td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
] +> (. +) <\/td>\s*<\/tr>/su ', $s, $m, Preg_set_order);p Rint_r ($m);
Preg_match_all ('/
]+>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/ td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
] +> (. +) <\/td>\s*<\/tr>/su ', $s, $m, Preg_set_order);p Rint_r ($m);
The last question, I want to take Javascript:detail (' R2013031500000871 ', ' 671529939 ') in the R2013031500000871 and 671529939, how to write it?
#1 reply The second one, isn't it?
#1 reply The second one, isn't it?
I mean a match, no more matching, two regular together
And when that happens, it's perfect.
Array ([ 0] = = Array ( [0] = = Chengdu e-commerce Co., Ltd. [1] = Rosie [2] = 51012200012484 [3] = = 73770103 [4] = 012121400045944 [5] = 75203619 ) [1] = = Array .....
Preg_match_all ('/
]+>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+> (\s*.+) <\/td>\s* <\/tr>/su ', $s, $m, preg_set_order);
Print_r ($m);
Such
Preg_match_all ('/
]+>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+>\s*.+<\/td>\s*<\/tr >/su ', $s, $m, preg_set_order);
Such
Preg_match_all ('/
]+>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+> (. +) <\/td>\s*
]+>\s*.+<\/td>\s*<\/ Tr>/su ', $s, $m, preg_set_order);
That's it, thanks for the split.
What tools do you use to test the regular, I use match Tracer and Expresso test, you help write the regular does not match, but PHP can, there is a last of the/su what mean?