MyBB Community Forums
Set a default value in this regex - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: MyCodes (https://community.mybb.com/forum-117.html)
+--- Thread: Set a default value in this regex (/thread-231199.html)



Set a default value in this regex - Walter_Correa - 2021-02-11

\[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?


RE: Set a default value in this regex - Omar G. - 2021-02-12

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\]



RE: Set a default value in this regex - Walter_Correa - 2021-02-12

(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)



RE: Set a default value in this regex - Omar G. - 2021-02-15

Try using you regex.


RE: Set a default value in this regex - Walter_Correa - 2021-02-15

(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?


RE: Set a default value in this regex - Omar G. - 2021-02-16

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.


RE: Set a default value in this regex - Walter_Correa - 2021-02-16

(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!