It is currently March 29th, 2024, 11:27 am
Get help with creating, editing & fixing problems with skins
Codger
Posts: 97 Joined: May 29th, 2017, 3:16 pm
Post
by Codger » August 19th, 2017, 3:34 pm
I have a fragment returned from webparser
Code: Select all
[MeasureLocation]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWebParseLocation]
StringIndex=2
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="^\s+":""
As you can see it strips off the opening newline.
Well they seemed to have added a closing newline or bunch of spaces as well.
I can not figure out how to strip them or it away.
By removing the '^' it did the trick except it took all the spaces from within the text as well.
Bear in mind the string might also be empty.
I have enough trouble with RegExp, then add in the substitute variant and make it tricky and I'm lost.
Could really use a helping hand on this.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
CyberTheWorm
Posts: 860 Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada
Post
by CyberTheWorm » August 19th, 2017, 3:46 pm
you will need to post at least the URL of the website you are trying to parse before we can help you.
Codger
Posts: 97 Joined: May 29th, 2017, 3:16 pm
Post
by Codger » August 19th, 2017, 4:07 pm
CyberTheWorm wrote: you will need to post at least the URL of the website you are trying to parse before we can help you.
Your wish...
This is the parser routine:
Code: Select all
[MeasureWebParseLocation]
Measure=Plugin
Plugin=WebParser
URL=#IPLocationSite#
RegExp="(?siU)<h1 id="heading">(.*)</h1>.*<td>City</td>.*<a class=".*" href=".*"></a>(.*)</td>.*</tr>.*<tr>.*<td data-loc=".*,.*">.*,.*</td>.*</tr>.*(?(?=.*<tr>.*<td>Postal).*<td>Postal Code</td>.*<td>(.*)</td>.*</tr>).*</table>"
DynamicVariables=1
UpdateRate=20
The url:
http://ipinfo.io/
Thanks
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
FreeRaider
Posts: 826 Joined: November 20th, 2012, 11:58 pm
Post
by FreeRaider » August 19th, 2017, 4:30 pm
Try this:
Code: Select all
RegExp=(?siU)<h1 id="heading">\s+\b(.*)\s+</h1>.*<td>City</td>.*<a class=".*" href=".*"></a>\s+\b(.*)</td>.*</tr>.*<tr>.*<td data-loc=".*,.*">.*,.*</td>.*</tr>.*(?(?=.*<tr>.*<td>Postal).*<td>Postal Code</td>.*<td>(.*)</td>.*</tr>).*</table>
Codger
Posts: 97 Joined: May 29th, 2017, 3:16 pm
Post
by Codger » August 19th, 2017, 4:59 pm
FreeRaider wrote: Try this:
Code: Select all
RegExp=(?siU)<h1 id="heading">\s+\b(.*)\s+</h1>.*<td>City</td>.*<a class=".*" href=".*"></a>\s+\b(.*)</td>.*</tr>.*<tr>.*<td data-loc=".*,.*">.*,.*</td>.*</tr>.*(?(?=.*<tr>.*<td>Postal).*<td>Postal Code</td>.*<td>(.*)</td>.*</tr>).*</table>
Didn't quite work, but gave me enough clues that once I understood the new bits I was able to make the final tweak.
Thank you very much.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
FreeRaider
Posts: 826 Joined: November 20th, 2012, 11:58 pm
Post
by FreeRaider » August 19th, 2017, 5:25 pm
Glad to make mistakes to help
Codger
Posts: 97 Joined: May 29th, 2017, 3:16 pm
Post
by Codger » August 19th, 2017, 6:15 pm
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."