This post was last edited by Snipersheep on 2013-08-01 15:52:47
$str = ' content a content B '
May I ask how to write the content A and content B in regular order?
Note: Content A has a newline character in the middle of content B.
Reply to discussion (solution)
What do you want to get content A and content B, or id= "test_0" text and id= "test_1" content?
Content A and Content B
Has nothing to do with ID. Not JS. is PHP fetch data.
$subject = ' You dead!helloJames Shit!hi
'; $pattern = '/Here is how to write/';p reg_match ($pattern, $subject, $matches);p Rint_r ($matches), $pattern _1 = '/Here is how to write/';p Reg_ Match ($pattern _1, $subject, $matches);p Rint_r ($matches) and fetch the result as follows: Data one: You Dead!helloJames Data II: SHIT!HI
$str = ' content a content B ';
Preg_match_all ('/(. *?) <\/div>/i ', $str, $match);
echo $match [2][0];//content A
echo $match [2][1];//content B
Silent Collection
Preg_match_all ('/(. *?) <\/div>/is ', $subject, $match);
Var_dump ($match);
Preg_match_all ('/(. *?) <\/div>/is ', $subject, $match);
Var_dump ($match);
There seems to be a problem. Not very accurate.
Array (3) { [0]=> Array (2) { [0]=> string (*) "You Dead!hello" [1]=> string (80) " Shit!hi " } [1]=> Array (2) { [0]=> string ()" Id= "Test_0" " [1]=> string ( "Id=" Test_1 "" } [2]=> Array (2) { [0]=> string () "You Dead!hello" [1]= > string (Shit!hi)} }
Less 〈/div〉.
Preg_match_all ('/(\s* (?: \ s*) <\/div>/us ', $subject, $match); Echo $match [0][0];echo '
'; Echo $match [0][1];
James shit! Hi
';p reg_match_all ('/]+> ([^<]*|< (?! DIV) | (? R) +) <\/div>/us ', $subject, $match); Echo $match [0][0];echo '
'; Echo $match [0][1];
James shit! Hi
';p reg_match_all ('/]+> ([^<]*|< (?! DIV) | (? R) +) <\/div>/us ', $subject, $match); Echo $match [0][0];echo '
'; Echo $match [0][1];Worship the Great God!