I have a simple question (not for me), ok, first, please take a look at this:
$msg=preg_replace("/\[b(.*?)\](.*?)\[\/b\]/i", "<b $1>$2</b>", $msg);
Well, on this regEXP, $ msg will replace the found thing and put it in a new form (I don't know how to explain, how about an example):
He will turn
[b]TEXT[/b]
at
<b>TEXT</b>
Or he will turn into
[b style="color: red;" title="HELLO"]TEXT[/b]
at
<b style="color: red;" title="HELLO">TEXT</b>
This raises the problem of what happens if it changes:
[b onclick="SOME TROJAN SCRIPT"]TEXT[/b]
at
<b onclick="SOME TROJAN SCRIPT">TEXT</b>
And all I want to do, instead of replacing all the attributes, is after [b attribute1 attribute2 ... attributeN], the function will remain those attributes AS LONG AS THEY NOT START WITH on (like onClick, onMouseOver ...).
I appreciate any suggestion ^^! Thanks guys in advanced ...
source
share