Ok, thx a lot for the help. At the end, it turned out as an easy issue, though it looked kind of serious in the beginning, even as a bug, at elast for me.jsmorley wrote: ↑October 26th, 2019, 1:46 pm You just need to \escape the | pipe character(s) as that character is reserved in regular expression and means "OR".
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.Code: Select all
InlinePattern=^(.*)\| InlineSetting=Color | 102,178,255,#colorText2Alpha# InlinePattern2=.*\|(.*)#deg#$ InlineSetting2=Color | 255,51,51,#colorText2Alpha#
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...
It is currently April 25th, 2024, 8:19 am
Inline option issue
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Inline option issue
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Inline option issue
Glad to help. Regular Expression is VERY powerful and useful, but far from the easiest or most intuitive thing to use.
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Inline option issue
Code: Select all
InlineSetting=Color | 102,178,255,#colorText2Alpha#
InlinePattern=([-]*[\d]+)
InlineSetting2=Color | 255,51,51,#colorText2Alpha#
InlinePattern2=([-]*[\d]+)
Text=%1 %2#deg#
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Inline option issue
What would you want? I didn't understand, but supposing you'd like to color the second numeric value, try this: InlinePattern=^-?[\d]+\s*(-?[\d]+)#deg#$.Pul53dr1v3r wrote: ↑January 19th, 2020, 8:31 pm what would be a simpler solution for this occurrence, when there is no any (visible) sign between the two values, %1 and %2 and what if there is not the space at all? The values can be negative as well. Tightly related with the previous posts.
Sorry if I misunderstood you.
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Inline option issue
no, it's my mistake. i didn't explain well what i want. So, the i'd like to maintain the same colors using a simple way like Morle's provided for the previous case,
Code: Select all
InlinePattern=^(.*)\|
InlineSetting=Color | 102,178,255,#colorText2Alpha#
InlinePattern2=.*\|(.*)#deg#$
InlineSetting2=Color | 255,51,51,#colorText2Alpha#
but now without the vertical bar sign "|", but with simple blank space.
To be honest, i don't know how to determine the end of the 1st InlinePattern and the begining of the second... It must be very easy.
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Inline option issue
Post please the code of the measure which has the posted InlineSetting / InliniPattern options set on.Pul53dr1v3r wrote: ↑January 19th, 2020, 11:27 pm To be honest, i don't know how to determine the end of the 1st InlinePattern and the begining of the second... It must be very easy.
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Inline option issue
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
color1=255,0,0
color2=0,0,255
[styleGlobal]
FontColor=255,255,255
[Measure1]
Measure=Calc
Formula=15
[Measure2]
Measure=Calc
Formula=-10
[Meter]
Meter=String
MeterStyle=styleGlobal
MeasureName=Measure1
MeasureName2=Measure2
InlineSetting=Color | #color1#
InlinePattern=
InlineSetting2=Color | #color2#
InlinePattern2=
Text=%1 %2°
This mr. Morley's advice might be helpful not to make a complicated formula: link
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Inline option issue
Try this:Pul53dr1v3r wrote: ↑January 20th, 2020, 3:35 pm here is the whole test code. so the first character must have color1, the second color2 and the "°" is untouched.
Code: Select all
[Meter]
...
InlineSetting=Color | #color1#
InlinePattern=^(-?[\d]+)\s*-?[\d]+[\x00B0]$
InlineSetting2=Color | #color2#
InlinePattern2=^-?[\d]+\s*(-?[\d]+)[\x00B0]$
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Inline option issue
ok, not the simplest but thx anyway.
i found that this one gives the same result, but not quite sure the result will be the same in all the possible cases:
And what in case where any of the values can be either positive or negative, numeric and non-numeric but without the whitespace (\s).
i found that this one gives the same result, but not quite sure the result will be the same in all the possible cases:
Code: Select all
InlineSetting=Color | #color1#
InlinePattern=^(.+)\s
InlineSetting2=Color | #color2#
InlinePattern2=\s(.+)[\x00B0]
Code: Select all
Text=%1%2[\x00B0]
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Inline option issue
Probably good, as well. The InlineSetting colors with #color1# everything from the beginning to the first space (defined by the \s symbol). InlineSetting2 colors with #color2# the string placed between the first space (\s) and the degree character ([\x00B0]).pul53dr1v3r wrote: ↑January 21st, 2020, 9:13 pm i found that this one gives the same result, but not quite sure the result will be the same in all the possible cases:Code: Select all
InlineSetting=Color | #color1# InlinePattern=^(.+)\s InlineSetting2=Color | #color2# InlinePattern2=\s(.+)[\x00B0]
What is different is that if there are no numbers but strings (replacing for instance the Calc measure with String ones), your solution works as well, while mine works only for numbers.
If there is no space, what do you use between the two temperature values? I'm not sure I follow.pul53dr1v3r wrote: ↑January 21st, 2020, 9:13 pm And what in case where any of the values can be either positive or negative, numeric and non-numeric but without the whitespace (\s).