d22552000 Posted August 13, 2008 Share Posted August 13, 2008 Well, I am making a web proxy, and I need to replace the url's the website (all of them) to point to sim_post.php?u=serializedurlhere . (Including images and scripts.) so I took a look around the web and tried to create a preg_replacement, it failed. Here is the error: Parse error: syntax error, unexpected '.', expecting ')' in C:\WOS\www\sim_post.php(22) : regexp code on line 1 Fatal error: preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Failed evaluating code: '/sim_post.php?u=/'.'\['.serialize(.'2'.).']' in C:\WOS\www\sim_post.php on line 22 and this is the php code: $pattern = "/(<a href=\")(.+?)(\")(\s*)(>)(.+?)(<\/a>)/e"; $replace = "'/sim_post.php?u=/'.'\\['.serialize(.'2'.).']'"; $page = do_post($_POST['url']); preg_replace($pattern, $replace, $page); I really do not know how to use regexp, and took a source to make links indexes from a google search. To be honest, it may be easier to create a whole new pattern and replacement, in comparison to trying to fix mine. I suck at regex ><. Quote Link to comment https://forums.phpfreaks.com/topic/119437-preg-replace-bad-syntax-regexp/ Share on other sites More sharing options...
d22552000 Posted August 13, 2008 Author Share Posted August 13, 2008 Please!? Quote Link to comment https://forums.phpfreaks.com/topic/119437-preg-replace-bad-syntax-regexp/#findComment-615289 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.