It is currently October 21st, 2019, 6:17 am

WebParser ignore error?

Help with creating, editing & fixing problems with skins
User avatar
Langlu
Posts: 13
Joined: June 7th, 2019, 11:49 pm

WebParser ignore error?

Langlu » June 22nd, 2019, 12:42 pm

I have set up a Measure site using WebParser.

The site constantly updates by checking the names of users that are connected to it. I have in my RegExp, searches that lead me right up to the actual name which I want to extract as strings. This search is the same before all names, but I do not know how many names will exist at the time of measure. So in RegExp, I have set up the copies of the search many times and then child measures for each stringindex.

I get RegExp matching error (-8). The skin stops working when loaded or refreshed because of this error. How can I make the skin work by ignoring this error since it it telling me that there is nothing to return (in this case, fewer users are connected than the number of Searches/Measures I have set up?)

I just want to be able to capture all instances of user names. Is setting up multiple searches the right way?

Hope I've explained my issue well enough.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3575
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: WebParser ignore error?

eclectic-tech » June 22nd, 2019, 12:49 pm

You can use Lookahead Assertion to avoid this error.
User avatar
Langlu
Posts: 13
Joined: June 7th, 2019, 11:49 pm

Re: WebParser ignore error?

Langlu » June 22nd, 2019, 1:48 pm

eclectic-tech wrote:
June 22nd, 2019, 12:49 pm
You can use Lookahead Assertion to avoid this error.
Thank you!
User avatar
balala
Rainmeter Sage
Posts: 8871
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: WebParser ignore error?

balala » June 22nd, 2019, 2:48 pm

If you can't get it to work properly, please post the code you have so far. Beside eclectic-tech's suggestion, Lookahead Assertion isn't something really easy to work with.
User avatar
Langlu
Posts: 13
Joined: June 7th, 2019, 11:49 pm

Re: WebParser ignore error?

Langlu » June 22nd, 2019, 2:56 pm

balala wrote:
June 22nd, 2019, 2:48 pm
If you can't get it to work properly, please post the code you have so far. Beside eclectic-tech's suggestion, Lookahead Assertion isn't something really easy to work with.
Here is a portion of the code that I cant seem to manage to get to work properly...

RegExp=(?siU).*<td class="text_left">10.10.(.*)</td>(?(?=.*<td class="text_left">10.).*10.(.*)</td>)

It is searching this text file:

<td class="text_left">1148</td>
<td class="text_left">10.10.60.62 (PPP-UK\actual.user)</td>
<td class="text_right">0</td>
<td class="text_left"></td>
<td class="text_left">User Limit</td>
<td class="text_left">2019-06-10 14:40:44</td>
<td class="text_left">

<td class="text_left">10.10.57.65 (PPP-UK\testing.user)</td>

First string returns 60.62 (PPP-UK\actual.user)

Great.

Then with the lookahead, it is returning 14:40:44

but I want it to return 57.65 (PPP-UK\testing.user)
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3575
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: WebParser ignore error?

eclectic-tech » June 22nd, 2019, 3:30 pm

"Period" (.) is a special character in Regular Expressions, it is used to specify ANY character.
You should "Escape" (\) any periods so they are seen as actual periods, and not as any character.

This will return your desired string:

Code: Select all

(?siU).*<td class="text_left">10\.10\.(.*)</td>(?(?=.*<td class="text_left">10\.).*10\.10\.(.*)</td>)
User avatar
balala
Rainmeter Sage
Posts: 8871
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: WebParser ignore error?

balala » June 22nd, 2019, 3:36 pm

Langlu, I meant you to post a COMPLETE code of the skin, not just a RegExp.
User avatar
Langlu
Posts: 13
Joined: June 7th, 2019, 11:49 pm

Re: WebParser ignore error?

Langlu » June 22nd, 2019, 3:40 pm

eclectic-tech wrote:
June 22nd, 2019, 3:30 pm
"Period" (.) is a special character in Regular Expressions, it is used to specify ANY character.
You should "Escape" (\) any periods so they are seen as actual periods, and not as any character.

This will return your desired string:

Code: Select all

(?siU).*<td class="text_left">10\.10\.(.*)</td>(?(?=.*<td class="text_left">10\.).*10\.10\.(.*)</td>)
Understood. Thanks.