Im creating a plugin that requires a mycode. I have the plugin currently creating the custom mycode and all fields are working correctly, apart from 1.
Im having problems with the "Regular Expression" field. When i activate the plugin its stripping the forward slashes (which is to be expected), resulting in the this:
[img](.*?)[/img]
Rather than getting this:
\[img\](.*?)\[/img\]
How can i stop it from stripping the forward slashes in this field?
Anyone any ideas on this?
Ive tried double escaping , still the same result
I think you'll need to post actual code or we won't know what you're doing.
Im just creating a "mycode" as part of a plugin, but when i activate the plugin its removing the backslashes (as expected) but im looking for a way around it. I have tried to double escape
$mycode = array(
"title" => "Test",
"description" => "Test",
"regex" => "\[Test\](.*?)\[/Test\]",
"replacement" => "",
"active" => "1",
"parseorder" => "0",
);
(2010-10-24, 10:47 PM)Janota Wrote: [ -> ]I have tried to double escape
No you haven't (which is why I asked you to post code). You just double escaped one of them.
"regex" => "\\[Test\\](.*?)\\[/Test\\]",
If you're putting that in a DB, you need to escape that again.
Yea thats what i did, i just left one of them in there by mistake when i posted the code here, i escaped them all in the plugin. But it didnt work for some reason.
Not sure if it helps, but I'm looking at a mycode plugin on my desktop and inside the coding goes like this (It's for an announcement):
function mycode_run ($message)
{
$mycode = array(
'#\[announce\](.*?)\[/announce]#si' => '<div style="border: 2px dashed rgb(204, 51, 68); margin: 2ex; padding: 2ex; color: black; background-color: rgb(255, 228, 233); align: center;"><div style="float: left; width: 2ex; font-size: 2em; color: red;"><strong>!!</strong></div><b style="text-decoration: underline;">Announcement</b><br/><div style="padding-left: 6ex;">\\1</div></div>',
);
Ive no problem adding the replacement, its the regular expression im having problems with ,when i activate the plugin i get this:
[
attachment=20334]
As you can see the backslashes are escaped. Even if i double escape the backslashes in the plugin i get the same result as in the image
can i see that plugin ?