FreeRaider wrote:Since InlinePattern uses Perl Compatible Regular Expression (PCRE), would not it be better to use (.*) or ^(.*)$ as default? Honestly, .* reminds me "not capture anything".
Feel free to use
InlineSetting=(.*) if you want, it is exactly the same as
InliineSetting=.*
If (parentheses) are used to capture parts of the string, then that is what the setting will be applied to. If (parentheses) are not used, then the part(s) of the string that match the regular expression will be used.
While it is indeed still "off the shelf" PCRE with exactly the same usage and rules that PCRE has in WebParser, what InlineSetting does with the result is somewhat different.
The entire and only point of WebParser is "capturing". The entire and only point of inlinePattern is "matching".
In a sense the (capture groups) are used to "limit" what the format is applied to in the string. The
entire string in inlinePattern must
match, or if you like, be
true. Things in parentheses (captures groups) can be used to identify a match in the context of a longer regular expression string. The ENTIRE regular expression must still "match" or be "true", or the entire setting will fail.
To repeat, the (capture groups) in InlinePattern are about "context".
Look at this example:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureOne]
Measure=String
String=The red, red robin
[MeterOne]
Meter=String
MeasureName=MeasureOne
FontSize=20
FontColor=0,0,0,255
SolidColor=240,240,240,255
Padding=5,5,5,5
AntiAlias=1
If we add an InlineSetting:
Code: Select all
InlineSetting=Color | 255,0,0,255
InlinePattern=red
That will change ANY instance of the word "red" in any order and in any context to the color red.
1.jpg
If we instead add...
Code: Select all
InlineSetting=Color | 255,0,0,255
InlinePattern=The red, (red) robin
That will change ONLY the occurrence of the word "red" in exactly this context (capture group) to the color red.
2.jpg
This InlineSetting:
Code: Select all
InlineSetting=Color | 255,0,0,255
InlinePattern=The red, (.*) robin
Will change any number of characters in exactly that context (capture group) to the color red.
4.jpg
This inlineSetting:
Code: Select all
InlineSetting=Color | 255,0,0,255
InlinePattern=The red, red robin
Will set the entire string to the color red, as the entire regular expression is matched.
5.jpg
So will this InlineSetting:
Code: Select all
InlineSetting=Color | 255,0,0,255
InlinePattern=(The red, red robin)
Its the same thing...
5.jpg
However this InlineSetting:
Code: Select all
InlineSetting=Color | 255,0,0,255
InlinePattern=The red, (red) cardinal
Will fail entirely. The match on the entire regular expression is NOT "true", and so no setting is applied.
3.jpg
In any case,
.* is always a match on any string.
(.*) is also always a match on any string. In either case, the match is "true", and the entire string will get the setting in question.
----------------------
Under the covers, what the new default setting for InlinePattern actually means is more like:
InlinePattern=(?s)^.*$. That's not important though. Just that it means "the entire string value".
You do not have the required permissions to view the files attached to this post.