Phantom-a Posted April 25, 2008 Share Posted April 25, 2008 How can I match the line of Numbers on this, to replace it in the next needle? THe problem is the numbers are random and always 5 characters long. $html = str_replace('example.css?93602','myexample',$html); Link to comment https://forums.phpfreaks.com/topic/102888-str_replace-with-a-regex/ Share on other sites More sharing options...
micah1701 Posted April 25, 2008 Share Posted April 25, 2008 for starters, you probably wanna use ereg_replace() or preg_replace() if you're using regex. Link to comment https://forums.phpfreaks.com/topic/102888-str_replace-with-a-regex/#findComment-527037 Share on other sites More sharing options...
Phantom-a Posted April 25, 2008 Author Share Posted April 25, 2008 I thought so too. Anymore help? $html = preg_replace('example.css?29229','myexample',$html); Link to comment https://forums.phpfreaks.com/topic/102888-str_replace-with-a-regex/#findComment-527048 Share on other sites More sharing options...
Phantom-a Posted April 25, 2008 Author Share Posted April 25, 2008 I found this. Looks like something I need. Not sure how to modify this to work? How about this , $numbers = "/[^0-9_]/i"; $html = preg_replace('example.css?.'$numbers',.proxifyURL('http://static.ak.fbcdn.net/css/ie6.css?.'$numbers'),$html); Link to comment https://forums.phpfreaks.com/topic/102888-str_replace-with-a-regex/#findComment-527053 Share on other sites More sharing options...
effigy Posted April 25, 2008 Share Posted April 25, 2008 preg_replace('/example\.css\?\d{5}/', 'replacement', $data); Link to comment https://forums.phpfreaks.com/topic/102888-str_replace-with-a-regex/#findComment-527082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.