| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Gold Sponsor 2015! |
Ok I am doing some ubb code for a forum I am getting this error:
Warning: Unknown modifier '/' in file.php on line 142
Line 142 is:
$msg = preg_replace("/[url](http://)?(.*?)[/url]/si", "<a href='12' target='_blank'>2</a>", $msg);
Any ideas what this means?
Ok I fixed the warning error by changing the line to this:
$msg = preg_replace("#/[url](http://)?(.*?)[/url]/si#", "<a href='12' target='_blank'>2</a>", $msg);
But now its not replacing it like it should. Any ideas?
You are using the slash as the delimiter for your regex. The engine will look for the first slash to end the expression.
Either choose a delimter that is not contained within your expression or escape the slashes.
Thanks andreasfriedrich I just figured that out now to tackle the next issue. Thanks again for the help.
Perhaps you would like to post an example of a string you want to perform the replacement on? That would be helpful to test your expression.
BTW I didnīt see that you already solved the first problem when I posted my reply and was just too lazy to edit it.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved