Ask php to extract html list data using regular expressions
Chengdu e-commerce Co., Ltd.Yang FA5101220001248473770103 Chengdu branch Technology Co., Ltd.Huang Canfa5110400017076766531815
New php
Ask php to extract javascript: Detail ('r2013031500000871 ', '123') "with regular expressions and the values in td,
A tr is a row. it is best to put it in an array. thank you.
Reply to discussion (solution)
$ S = <
Chengdu e-commerce Co., Ltd.Yang FA5101220001248473770103 Chengdu branch Technology Co., Ltd.Huang Canfa5110400017076766531815 Txt; preg_match_all ('/
] +> (. +) <\/Td>/sU ', $ s, $ m); print_r ($ m [1]); // The value of td is preg_match_all ('/
Oh, one print parameter is missing.
Preg_match_all ('/print_r ($ ar [1]); // parameter 1
Print_r ($ ar [2]); // parameter 2
Oh, one print parameter is missing.
Preg_match_all ('/print_r ($ ar [1]); // parameter 1
Print_r ($ ar [2]); // parameter 2
A tr is a row, because tr may be multiple rows in actual conditions. I want to match by tr and retrieve the values under each tr td line as an array.
preg_match_all('/
]+>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*<\/tr>/sU',$s,$m,PREG_SET_ORDER);print_r($m);
preg_match_all('/
]+>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*
]+>(.+)<\/td>\s*<\/tr>/sU',$s,$m,PREG_SET_ORDER);print_r($m);
In my last question, how do I write the following information about the R2013031500000871 and 671529939 in javascript: Detail ('r2013031500000871 ', '123?
#1. reply to the second question. isn't it?
#1. reply to the second question. isn't it?
I mean one match, no need to match again, that is, two regular expressions are merged together.
The result will be perfect.
Array ([0] => Array ([0] => Chengdu e-commerce Co., Ltd. [1] => Yang FA [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 );
So?
Preg_match_all ('/
] +> \ S *
] +> (. +) <\/Td> \ s *
] +> (. +) <\/Td> \ s *
] +> (. +) <\/Td> \ s *
] +> (. +) <\/Td> \ s *
] +> \ S *. + <\/td> \ s * <\/tr>/sU ', $ s, $ m, PREG_SET_ORDER );
So?
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 a lot!
What tool did you use to test the regular expression? I used the Match Tracer and Expresso tests. the regular expression you wrote cannot Match, but it can be used in php, what does the last/sU mean?