Hello,
I have a lot of trouble trying to get a preg_replace() to work. This is what it is supposed to do -
User inputs -
[code1=lang]//some code[/code1]
It supposed to take the lang value above and add it to the class attribute of a pre tag. And take the "//some code" and put it between the pre tags.
Like so -
<pre name="code" class="lang">//some code</pre>
Current code that is not working -
$code = '[code1=php] echo "Hello"; [/code1] ';
echo preg_replace('#\[code1=([^\]]+)\](.*?)\[/code1\]#eis', "<pre name=code class='\1'>'\2'</pre>", $code);
It ouputs nothing.
Please help,
Thanks,