MyBB Community Forums

Full Version: Mycode for greentext?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Regular expression: (\n|^)>(.*?)(\n|$)

Replacement: $1<span style="color: #4CAF50;">&gt;$2</span>$3

What it does:

Whenever someone writes > it greentexts whatever is after the symbol, as long as it is on a new line

Result:
>hello

Problem:

With the above code, this happens:

>if you greentext
>many lines
>it only makes
>every other
>line green

How do I fix this? I did look for previous threads about this, but no fix for this problem.

Thanks
Maybe trying non-capturing groups for the newline / start of string and newline / end of string?

Regular expression: (?:\n|^)&gt;(.*?)(?:\n|$)

Replacement: <span style="color: #4CAF50;">&gt;$1</span>

Note that I haven't tried this.
^ sorry, that doesn't work as required ..

@OP, see also this reply & this reply

YourCode plugin details
if the plugin is used then Multi-line mode needs to be set to yes at Advanced settings of the code (see this image)
(2017-12-12, 05:17 PM).m. Wrote: [ -> ]^ sorry, that doesn't work as required ..

@OP, see also this reply & this reply

YourCode plugin details
if the plugin is used then Multi-line mode needs to be set to yes at Advanced settings of the code (see this image)

Sorry, but i have no idea where that is, @.m.

This is what I see:
https://i.imgur.com/mSaB6SM.png
^ in general, a plugin is needed to fulfill your requirement. suggestion is to install & use YourCode plugin ..
(2017-12-13, 02:14 AM).m. Wrote: [ -> ]^ in general, a plugin is needed to fulfill your requirement. suggestion is to install & use YourCode plugin ..

Thank you, I´ll try.