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"}}} Link to comment https://forums.phpfreaks.com/topic/149278-solved-replace-space-character-problem/ 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); Link to comment https://forums.phpfreaks.com/topic/149278-solved-replace-space-character-problem/#findComment-783932 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 Link to comment https://forums.phpfreaks.com/topic/149278-solved-replace-space-character-problem/#findComment-783934 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 Link to comment https://forums.phpfreaks.com/topic/149278-solved-replace-space-character-problem/#findComment-783937 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 Link to comment https://forums.phpfreaks.com/topic/149278-solved-replace-space-character-problem/#findComment-783938 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 Link to comment https://forums.phpfreaks.com/topic/149278-solved-replace-space-character-problem/#findComment-783939 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 Link to comment https://forums.phpfreaks.com/topic/149278-solved-replace-space-character-problem/#findComment-783940 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.