You just need to \escape the
| pipe character(s) as that character is reserved in regular expression and means "OR".
Code: Select all
InlinePattern=^(.*)\|
InlineSetting=Color | 102,178,255,#colorText2Alpha#
InlinePattern2=.*\|(.*)#deg#$
InlineSetting2=Color | 255,51,51,#colorText2Alpha#
While it won't hurt, the trailing
$ is really not needed, as it will stop capturing when it hits #deg#. To be honest, the leading
^ is also not really needed, as it will always start at the beginning of the string. It both cases though, it does no harm, and may make it a bit clearer as to the intent.
There is really no need to
.* skip to the
\| in InlinePattern2. Regular expression will by its nature skip to the first instance of anything you are trying to "match" from the start of the string. Again, does no harm...
The difference between
* (zero or more) and
+ (one or more) is not really important in this case, although I tend to use
+ when (capturing) in InlinePattern, as the logic of "color this red if there are none of them" offends me at some level...
Probably the most technically perfect form of this is:
Code: Select all
InlinePattern=(.+)\|
InlineSetting=Color | 102,178,255,#colorText2Alpha#
InlinePattern2=\|(.+)#deg#
InlineSetting2=Color | 255,51,51,#colorText2Alpha#