#30348
Yutaka Emura
Keymaster

EmEditor v25.3 preview 1 (25.2.901) introduces experimental support for using special keywords in regex highlight strings to set additional conditions.

(?#_text_c==n) applies the highlight only if the text at the start of the match is already using color ‘n’.
(?#_text_c!=n) applies the highlight only if the text at the start of the match is *not* using color ‘n’.

Here, n is an integer representing a specific color, as defined in plugin.h. For example:


#define SMART_COLOR_NORMAL          0
#define SMART_COLOR_HILITE_4        17
// ...and so on

To set a condition, one of these keywords must appear at the very beginning of your highlight string.

For instance, instead of just writing %%.*$, you could use (?#_text_c!=17)%%.*$ to highlight lines starting with %% only if they don’t already use the color corresponding to n = 17 (SMART_COLOR_HILITE_4).

Hope this helps clarify how to use this new feature!