Set a default value in this regex
#1
\[shadow=(.*?)\](.*?)\[/shadow\]

<span style="text-shadow: 0px 0px 5px $1;">$2</span>

I want to set a default color if is empty:

If the I use only [shadow]Test[/shadow] convert to [shadow=Gray]Test[/shadow]

Its possible?
Reply
#2
Try to create the [shadow]Test[/shadow] MyCode and assign a Parse Order lower than that of the [shadow=Gray]Test[/shadow] MyCode.

Try the following Regex instead BTW:
\[shadow=([a-z\-]+|\\#?[0-9a-f]{6})\](.+?)\[/shadow\]
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#3
(2021-02-12, 08:35 AM)Omar G. Wrote: Try to create the [shadow]Test[/shadow] MyCode and assign a Parse Order lower than that of the [shadow=Gray]Test[/shadow] MyCode.

Try the following Regex instead BTW:
\[shadow=([a-z\-]+|\\#?[0-9a-f]{6})\](.+?)\[/shadow\]
[2] preg_replace(): Unknown modifier '?' - Line: 484 - File: F:\Inetpub\vhosts\darkstreetrpg.com.br\httpdocs\forum\inc\class_parser.php PHP 7.4.14 (WINNT)
Reply
#4
Try using you regex.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#5
(2021-02-15, 06:14 AM)Omar G. Wrote: Try using you regex.
Sorry, I don't understand how this Parser Order system works. Can you help me?
Reply
#6
Please read the following:
https://docs.mybb.com/1.6/Admin-CP-Config-MyCode/

See the attached images for more insight.

Please note that it should be possible to do this with one single MyCode and such way should be chosen instead, I'm just sharing a different way to do it.


Attached Files Thumbnail(s)
                   
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#7
(2021-02-16, 01:18 AM)Omar G. Wrote: Please read the following:
https://docs.mybb.com/1.6/Admin-CP-Config-MyCode/

See the attached images for more insight.

Please note that it should be possible to do this with one single MyCode and such way should be chosen instead, I'm just sharing a different way to do it.
wow... thank you so much!
Reply


Forum Jump:


Users browsing this thread: