It is currently March 28th, 2024, 1:39 pm

RegExp matching error (-1), (-8)

Get help with creating, editing & fixing problems with skins
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: RegExp matching error (-1), (-8)

Post by CyberTheWorm »

qwerky wrote: March 22nd, 2019, 5:04 pm Naw... it was fine. But while a "toque" may be okay for U.S. weather, for real Canadian weather one really needs a "touque"! :rofl:
But do you really need one unless it gets below -40?
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: RegExp matching error (-1), (-8)

Post by qwerky »

CyberTheWorm wrote: March 22nd, 2019, 9:35 pm But do you really need one unless it gets below -40?
Turns out, -40 degrees is the same in U.S. (F) as in Canada (C); whooda thunkit?

But yeah, time passes, hair thins, major heat-loss through scalp. :lol:
User avatar
GTI.H
Posts: 75
Joined: December 15th, 2018, 3:35 am

Re: RegExp matching error (-1), (-8)

Post by GTI.H »

jsmorley wrote: March 21st, 2019, 10:49 pm As far as I know, these are the error codes returned by PCRE (Perl Compatible Regular Expression)




I'm not entirely sure they are of much value in debugging stuff, but in general -1 is just "no match", and -8 means that its attempt to resolve the match has resulted in an endless loop that exceeds an internal limit in PCRE. Both are just an invalid regular expression for the string being parsed.
This information should be in the WebParser measure documentation, right?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RegExp matching error (-1), (-8)

Post by jsmorley »

GTI.H wrote: March 23rd, 2019, 9:37 pm This information should be in the WebParser measure documentation, right?
I would say not actually. It's not Rainmeter's goal to teach you regular expression, as it is not Rainmeter's goal to teach you Lua. That is well beyond the capabilities of our modest documentation, and really beyond the knowledge and skill of anyone on the team, or in the entire community, to comprehensively or perhaps even unambiguously and accurately, accomplish.

You want to get in a war on the internet? Just go to any technical site and proclaim that you have found the best way to accomplish a task, even the most simple and straightforward, with regular expression.
User avatar
GTI.H
Posts: 75
Joined: December 15th, 2018, 3:35 am

Re: RegExp matching error (-1), (-8)

Post by GTI.H »

jsmorley wrote: March 23rd, 2019, 11:26 pm I would say not actually. It's not Rainmeter's goal to teach you regular expression, as it is not Rainmeter's goal to teach you Lua. That is well beyond the capabilities of our modest documentation, and really beyond the knowledge and skill of anyone on the team, or in the entire community, to comprehensively or perhaps even unambiguously and accurately, accomplish.

You want to get in a war on the internet? Just go to any technical site and proclaim that you have found the best way to accomplish a task, even the most simple and straightforward, with regular expression.
Ok!
User avatar
Yincognito
Rainmeter Sage
Posts: 7021
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: RegExp matching error (-1), (-8)

Post by Yincognito »

jsmorley wrote: March 23rd, 2019, 11:26 pmYou want to get in a war on the internet? Just go to any technical site and proclaim that you have found the best way to accomplish a task, even the most simple and straightforward, with regular expression.
This reminds me of the habbit of people nowadays to claim that an information is unreliable just because the source of it is Wikipedia, LOL. This trend of consistently discrediting or dismissing things just because the source or the methods for those things have their own limits is usually an easy way to get away from an argument for those who either don't bother / don't know how to use such features or take things they heard or saw somewhere literally, without even trying first.

"Don't parse HTML with RegExp", they say, LOL. I did parse HTML with it, actually, and it all works well - you just have to know not to parse more HTML than regex can handle. For most HTML chunks, regex is just fine - just not for an entire page, that's all. As always, balance is the key: some things work better with an actual HTML parser, and some are better suited for regexes.

Some technical sites are actually stagnating in terms of rigid rule and rigid axioms they take for granted. This happens to every entity once it becomes too big, too wealthy, or too famous: they forget what made them great in the first place, which is usually thinking outside the box.
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: RegExp matching error (-1), (-8)

Post by qwerky »

jsmorley wrote: March 23rd, 2019, 11:26 pm That is well beyond the capabilities of our modest documentation, and really beyond the knowledge and skill of anyone on the team, or in the entire community, to comprehensively or perhaps even unambiguously and accurately, accomplish
Without taking a side one way or the other, I just wish to say that the Rainmeter documentation is, beyond doubt, some of the very best available for most any product on the Internet. I am constantly amazed by the comprehensive coverage, as well as the level of detail. Big thumbs up! :Medal

And in spite of all that, I'm frequently coming to the forums for help, which is no doubt because this is truly one of the friendliest, most helpful forums a product could wish for. So a big thanks to all the helpful people here! :Trophy
User avatar
Yincognito
Rainmeter Sage
Posts: 7021
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: RegExp matching error (-1), (-8)

Post by Yincognito »

I'm in full agreement with qwerky on that one. :thumbup:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RegExp matching error (-1), (-8)

Post by jsmorley »

Yincognito wrote: March 24th, 2019, 12:05 am "Don't parse HTML with RegExp", they say, LOL. I did parse HTML with it, actually, and it all works well - you just have to know not to parse more HTML than regex can handle. For most HTML chunks, regex is just fine - just not for an entire page, that's all. As always, balance is the key: some things work better with an actual HTML parser, and some are better suited for regexes.
I am myself skeptical of parsing HTML sites. Not because it can't be done, because parsing is parsing, and as long as you can figure out a reasonable pattern for how things are presented in the HTML code, it's no harder than parsing XML (RSS or ATOM).

However, I would caution, and have had it proven more times then I care to count, that you can't depend on any HTML site staying the way it is for very long. It is up to some webmaster who is currently in a bad relationship, or some marketing drone or pointy-haired manager who doesn't even know HTML, or even just some outsourced code monkey they hire to add some new information to the site on a one-week contract. There is never any promise, and should never be any expectation, that any regular expression you used yesterday will work tomorrow. In addition, this may mean a minor tweak, or a complete rewrite of everything you have done. One is as likely as the other.

So while it is certainly true there are some sites that you really want to get at, and they are only available in HTML, you simply have to accept the fact that probably in a few months from now, and almost certainly in a year or so, it's going to stop working unless you intercede. So be prepared for a long-term commitment to support of your skin, unless you are just a bastard, and throw it over the wall and walk away...

I have a skin that uses an HTML site and tracks the standings in Major League Baseball, and while I really like it and use it myself every year, I find I have to put a fair amount of work into it every year, right at the start of the season. I do so, but not without some grumbling....
User avatar
Yincognito
Rainmeter Sage
Posts: 7021
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: RegExp matching error (-1), (-8)

Post by Yincognito »

jsmorley wrote: March 24th, 2019, 2:35 am I am myself skeptical of parsing HTML sites. Not because it can't be done, because parsing is parsing, and as long as you can figure out a reasonable pattern for how things are presented in the HTML code, it's no harder than parsing XML (RSS or ATOM).

However, I would caution, and have had it proven more times then I care to count, that you can't depend on any HTML site staying the way it is for very long. I have a skin that uses an HTML site and tracks the standings in Major League Baseball, and while I really like it and use it myself every year, I find I have to put a fair amount of work into it every year, right at the start of the season. I do so, but not without some grumbling....
You're probably right, after all, it's a changing world each day. I don't know the specifics of your skin and address that you access, but usually sticking with generic stuff, choosing carefully what you interrogate/parse (e.g. elements that you noticed that are more "persistent" in time) and using patterns instead of specific/hard-coded references when you're parsing should help. This is where generic stuff to "fill the blanks" like .* for regex, or flexible selectors like querySelectorAll() for actual parsers come handy.

This topic is perfect for such a discussion, since qwerky apparently also uses a site that suffers (this time, seasonal) changes over a period of time. Me, I would have tried not to be picky and ditch the volatile Wind Chill, Heat Index or Feels Like (in his case), and just stick with the stuff that is always there, like plain temperature, or wind speed or whatever. Some element might seem cool to have and all, but bear little importance compared to the more generic ones. One such example in wxdata's case is UV Index, Feels Like, Wind Gust or Dew Point. I mean, such elements can be easily approximated based on the more broad (and more persistent in time) elements like Temperature, Wind Speed, Humidity or even Atmospheric Pressure.
Post Reply