Need help with thisI've been using stars to convert to preg_replace but there is already a star present and it's giving more errors. How do I fix it?PHP Code:eregi_replace("title=\"([^\\[]*)\">link</a>\\]\\]","]",$text);
Printable View
Need help with thisI've been using stars to convert to preg_replace but there is already a star present and it's giving more errors. How do I fix it?PHP Code:eregi_replace("title=\"([^\\[]*)\">link</a>\\]\\]","]",$text);
I'm guessing that you're referring to a conflicting delimiter? If you regex has an asterisk (star) in it already, you can just use another character;This one uses '#' as the delimiter.Code:preg_replace("#title=\"([^\\[]*)\">link</a>\\]\\]#i","]",$text);
Is that what you mean? Does that help?
Thanks. That helps a bunch. Your code looks a little different to mine with the i at the end of the line. May I ask what that is for? Will it make a difference if I don't use it?
You original code used eregi_replace, which is for case-insensitivity, so the "i" after the # delimiter in the updated preg_replace function does the same thing - it makes the regex case-insensitive.
If case-insensitivity was in effect in the earlier version of your script, it would be best to keep it that way in the update to avoid any complications/incompatibilities with whatever text is being replaced.
Okay, I will change my code to match your example.
Thanks again for your help. I will probably need more help soon so I will return.
No problem. Come back any time :)