It is currently October 17th, 2021, 4:19 pm

[SOLVED]Question about using >+ and " " (spacebar) in Regexp (webparser)

Help with creating, editing & fixing problems with skins
gkmaz9
Posts: 57
Joined: August 26th, 2019, 10:42 am

[SOLVED]Question about using >+ and " " (spacebar) in Regexp (webparser)

Post by gkmaz9 »

Hello!
See you after a long time.
How have you been?

During web parsing, there are difficulties with regular expressions.
I want to ask for help.

Code: Select all

-problem part(web)-
<variable value>+AAA variable value

[MeasureWebParser]
Measure=WebParser
URL="www.aaa.com"
RegExp=(?siU)>+(.*) .*
DynamicVariables=1
I'm trying to extract the Value AAA between >+ and ' '(spacebar) from a web document via regexp.

1. There seems to be a problem with the + being recognized as a regular expression.
I need a solution for this part.
2. I don't know how to write ' '(space bar)value to extract AAA.

I would like to ask for a solution to this.
Please help.
Last edited by gkmaz9 on October 7th, 2021, 4:17 am, edited 2 times in total.
User avatar
jsmorley
Developer
Posts: 22367
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about using >+ and " " (spacebar) in Regexp (webparser)

Post by jsmorley »

gkmaz9 wrote: October 6th, 2021, 12:30 am Hello!
See you after a long time.
How have you been?

During web parsing, there are difficulties with regular expressions.
I want to ask for help.

Code: Select all

-problem part(web)-
<variable value>+AAA variable value

[MeasureWebParser]
Measure=WebParser
URL="www.aaa.com"
RegExp=(?siU)>+(.*) .*
DynamicVariables=1
I'm trying to extract the Value AAA between >+ and ' '(spacebar) from a web document via regexp.

1. There seems to be a problem with the + being recognized as a regular expression.
I need a solution for this part.
2. I don't know how to write ' '(space bar)value to extract AAA.

I would like to ask for a solution to this.
Please help.
RegExp=(?siU)>\+*(.*) .*

You just need to escape the + with \.
gkmaz9
Posts: 57
Joined: August 26th, 2019, 10:42 am

Re: Question about using >+ and " " (spacebar) in Regexp (webparser)

Post by gkmaz9 »

jsmorley wrote: October 6th, 2021, 3:12 am RegExp=(?siU)>\+*(.*) .*

You just need to escape the + with \.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
FontSize1=12
FontSize2=17
FontColor=255, 255, 255, 255
FontWeight1=400

[BOX]
Meter=STRING
X=0
Y=0
W=300
H=400
SolidColor=0,0,0,50

[MeasureEx1]
Measure=String
String=<viox>+12<dison2>ddd23ds/1<'Random'>+33 Random
RegExpSubstitute=1
Substitute="'>\+*(.*) .*":"ABC"

[String_B]
Meter=STRING
Text=[MeasureEx1]
X=130
Y=130
FontColor=#FontColor#
FontSize=#FontSize1#
FontFace=#FontName#
AntiAlias=1
ClipString=1
DynamicVariables=1
group=G1
RegExpSubstitute=1
Unfortunately it doesn't work. I've tried various things, but it doesn't work. I need help.
I have written specific code.

-String-
<viox>+12<dison2>ddd23ds/1<'Random'>+33 Random

In the following String, I want to replace 33 with ABC
The 'random' part of that String assumes that the text changes randomly.

--------
To put it more simply, I want to know how to extract aa from " random letters'>+aa bbb "
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4420
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Question about using >+ and " " (spacebar) in Regexp (webparser)

Post by eclectic-tech »

This will replace everything between '>+ and a whitespace with ABC while retaining all the other text.

Code: Select all

[MeasureEx1]
Measure=String
String=<viox>+12<dison2>ddd23ds/1<'Random'>+33 Random
RegExpSubstitute=1
Substitute="^(.*)'>\+*(.*) (.*)$":"\1'>+ABC \3"

Hope this is what you are looking for.
gkmaz9
Posts: 57
Joined: August 26th, 2019, 10:42 am

Re: Question about using >+ and " " (spacebar) in Regexp (webparser)

Post by gkmaz9 »

I solved it properly by referring to the two answers. thank you. It helped a lot.