php - Why preg_match() didn't work with my expression? -
i have in php expression:
preg_match("/\<div id=\"servertc\">(.+)\<\/div>/",$data,$out);
and in $data contain:
<div id="servertc">nowy serwer evolution!<br><br> ~ server info ~<br> ip: axera.pl (port: 7171)<br> online: 24/7<br> world type: pvp (protection level: >100)<br> house rent: disabled.<br> ~ rates ~<br> experience player: x2<br> magic level: x15<br> skills: x30<br> loot: x3<br> spawn: x3<br> houses: 100 level<br> guilds: 8 level (create via website)<br> red skull (24h): 25 unjustified kills per day<br> black skull (48h): 50 unjustified kills per day<br> idle kick time = 15 minut<br> ~ exp stages ~<br> 1-50: x 650<br> 51-75: x 450<br> 76-100: x 300<br> 101-150: x 150<br> 151-175: x 100<br> 176-190: x 75<br> 191-230: x 35<br> 231-250: x 20<br> 251-280: x 15<br> 281-300: x 8<br> 301 +: x 2 </div>
scripts return empty array. problem?
you need use pcre_dotall (s) flag in order make dot match newline:
/\<div id=\"servertc\">(.+?)\<\/div>/s
however let me warn parsing html bad idea using regex. better use dom parser parsing html text yours.
Comments
Post a Comment