4images Forum & Community
General / Allgemeines => Programming => Topic started by: Sunny C. on December 14, 2010, 11:06:13 PM
-
Hello this Code dont work for me:
$text = preg_replace("/\[shadow\][color=#(.*?)\](.*?)\[\/color\][\/shadow\]/si", "<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>", $text);
$text = preg_replace("/\[color=#(.*?)\][shadow\](.*?)[\/shadow\]\[\/color\]/si", "<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>", $text);
Error:
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 52 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 357
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 52 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 358
I cantīt find the error!
-
statt " dieses ' im Netz wird das so angeboten
$text = preg_replace('/\
z.B
$text = preg_replace('/\[color=([[:alnum:]]{6}?).*\](.*?)\[\/color\]/', '<font color="#$1">$2</font>', $text);
-
Danke dir.
Das habe ich allerdings auch schon versucht.
Das Problem ist das ich zwei Bbcode Varianten auf einmal umwandeln will.
Ich werde das aber noch etwas austesten!
-
$text = preg_replace("/\[shadow\]\[color=#[a-z0-9]+\](.*)\[\/color\]\[\/shadow\]/si", "<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>", $text);
$text = preg_replace("/\[color=#[a-z0-9]+\]\[shadow\](.*)\[\/shadow\]\[\/color\]/si", "<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>", $text);
-
Thank you Vano,
but the errors are still there!
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 357
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 358
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 53 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 377
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 53 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 378
-
updated above
-
Also does not help.
I have now tried many things, but it does not work.
However, it was previously shown more mistakes and now only two errors displayed.
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 357
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 358
-
are you sure on lines 357 and 358 my code? I doubt it.
-
You were right.
The Bbcode now causes no errors, but my idea did not succeed.
Look at the screenshot.
The color code from Color Bbcode supposed to be used for the shadow.
<span style=\"text-shadow: 2px 2px 5px #COLOR-CODE-FROM-COLOR-BBCODE\">TEXT</span>
-
looks like you need move these lines above all other preg_replace..so they would be replaced first, then the rest of your bbcode
the sequence at witch your text is being replace does matter ;)
-
I've already done. But then nothing displays.
That's all pretty complex!