maddogandnoriko Posted March 13, 2009 Share Posted March 13, 2009 I am trying to replace space characters returned in short an html string with nothing to help me build a regex statement. I tried this with no joy: $thtml = str_ireplace(' ','',$thtml); and here is the string: {"links_existed":{1958300:{"id_str":"1958300", "filename":"bw.0102.part1.rar", "size":"104857600", "download_url":"http://depositfiles.com/files/1958300"}, 1958303:{"id_str":"1958303", "filename":"bw.0102.part2.rar", "size":"104857600", "download_url":"http://depositfiles.com/files/1958303"}, "ve4w82ro7":{"id_str":"ve4w82ro7", "filename":"DFManagerSetup.exe", "size":"1063760", "download_url":"http://depositfiles.com/files/ve4w82ro7"}}, "links_deleted":{1493393:{"id_str":"1493393", "filename":"Cap.iKA.part1.rar", "size":"104750000", "download_url":"http://depositfiles.com/files/1493393"}}} Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 13, 2009 Share Posted March 13, 2009 Tried it without the i before replace? Try this: $thtml = str_replace(" ", "", $thtml); Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 13, 2009 Share Posted March 13, 2009 Why do you want to remove the spaces from that string? Ken Quote Link to comment Share on other sites More sharing options...
maddogandnoriko Posted March 13, 2009 Author Share Posted March 13, 2009 did just now, still no luck. Sounded like a good solution to me though. Todd Quote Link to comment Share on other sites More sharing options...
maddogandnoriko Posted March 13, 2009 Author Share Posted March 13, 2009 Ken, I am new to regex and have a problem getting past the space characters. Ultimately I am trying to put a regex together to extract the good links and bad links into separate arrays, where the links vary in number. todd Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 13, 2009 Share Posted March 13, 2009 This: <?php $x = '{"links_existed":{1958300:{"id_str":"1958300", "filename":"bw.0102.part1.rar", "size":"104857600", "download_url":"http://depositfiles.com/files/1958300"}, 1958303:{"id_str":"1958303", "filename":"bw.0102.part2.rar", "size":"104857600", "download_url":"http://depositfiles.com/files/1958303"}, "ve4w82ro7":{"id_str":"ve4w82ro7", "filename":"DFManagerSetup.exe", "size":"1063760", "download_url":"http://depositfiles.com/files/ve4w82ro7"}}, "links_deleted":{1493393:{"id_str":"1493393", "filename":"Cap.iKA.part1.rar", "size":"104750000", "download_url":"http://depositfiles.com/files/1493393"}}}'; $z = str_replace(' ','',$x); echo $z . "<br>\n"; ?> works fine. Can you post more of your code? Ken Quote Link to comment Share on other sites More sharing options...
maddogandnoriko Posted March 13, 2009 Author Share Posted March 13, 2009 I took a closer look at the html and it is not space characters, it is return characters. My apologies. And thank you for helping me find the problem. Todd Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.