Skip to content

Commit

Permalink
Removed double quotes on WebParser RegExp
Browse files Browse the repository at this point in the history
`RegExp="(?siU)<link>(.*)</link>"` is valid, but it might cause confuse in some cases.
`RegExp=(?siU)<img src="(.*)">` is better than `RegExp="(?siU)<img src="(.*)">"`
  • Loading branch information
nek7u committed Oct 2, 2024
1 parent aa9de85 commit 52f545a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion source/tips/measure-as-a-variable.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h3>When are the string and number values different?</h3>
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=https://www.somesite.com/logs/status.xml
RegExp="(?siU)<status>(.*)</status>"
RegExp=(?siU)<status>(.*)</status>
StringIndex=1
Substitute="Running":"1","Offline":"0"

Expand Down
22 changes: 11 additions & 11 deletions source/tips/webparser-using-stringindex2.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[MeasureSite]
Measure=WebParser
Url=https://www.howtogeek.com/feed/
RegExp="(?siU)<channel>.*<title> (.*) </title>.*<link>(.*)</link>#Item##Item##Item#"
RegExp=(?siU)<channel>.*<title> (.*) </title>.*<link>(.*)</link>#Item##Item##Item#

[MeasureMainTitle]
Measure=WebParser
Expand All @@ -39,45 +39,45 @@
[MeasureItem1Title]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<title>(.*)</title>"
RegExp=(?siU)<title>(.*)</title>
StringIndex=3
StringIndex2=1
Substitute=#Sub#

[MeasureItem1Link]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<link>(.*)</link>"
RegExp=(?siU)<link>(.*)</link>
StringIndex=3
StringIndex2=1

[MeasureItem2Title]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<title>(.*)</title>"
RegExp=(?siU)<title>(.*)</title>
StringIndex=4
StringIndex2=1
Substitute=#Sub#

[MeasureItem2Link]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<link>(.*)</link>"
RegExp=(?siU)<link>(.*)</link>
StringIndex=4
StringIndex2=1

[MeasureItem3Title]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<title>(.*)</title>"
RegExp=(?siU)<title>(.*)</title>
StringIndex=5
StringIndex2=1
Substitute=#Sub#

[MeasureItem3Link]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<link>(.*)</link>"
RegExp=(?siU)<link>(.*)</link>
StringIndex=5
StringIndex2=1

Expand Down Expand Up @@ -153,7 +153,7 @@
[MeasureSite]
Measure=WebParser
Url=https://www.howtogeek.com/feed/
RegExp="(?siU)<title>(.*)</title>.*<link>(.*)</link>#Item##Item##Item#"
RegExp=(?siU)<title>(.*)</title>.*<link>(.*)</link>#Item##Item##Item#
```

<p>Notice we are doing something a bit different here. Instead of fully parsing the site into many, many StringIndexes on the main measure, we are just getting the main title and link for the site into StringIndexes 1 and 2, then getting the <em>entire</em> contents of each &lt;item&gt; into StringIndexes 3, 4 and 5.</p>
Expand All @@ -163,7 +163,7 @@
[MeasureItem1Title]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<title>(.*)</title>"
RegExp=(?siU)<title>(.*)</title>
StringIndex=3
StringIndex2=1
Substitute=#Sub#
Expand All @@ -180,7 +180,7 @@
[MeasureItem1Link]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<link>(.*)</link>"
RegExp=(?siU)<link>(.*)</link>
StringIndex=3
StringIndex2=1
```
Expand All @@ -192,7 +192,7 @@
[MeasureItem2Title]
Measure=WebParser
Url=[MeasureSite]
RegExp="(?siU)<title>(.*)</title>"
RegExp=(?siU)<title>(.*)</title>
StringIndex=4
StringIndex2=1
Substitute=#Sub#
Expand Down

0 comments on commit 52f545a

Please sign in to comment.