It is currently September 21st, 2019, 6:13 pm

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

Help with creating, editing & fixing problems with skins
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

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

qwerky » March 21st, 2019, 10:41 pm

In testing my weather skin, I've been trying different cities. In so doing, I've received some RegExp matching errors in the log; some with (-1) and some with (-8). Searching the documentation and the forum hasn't turned up a description of what the numbers refer to. Is there a list somewhere?
User avatar
jsmorley
Developer
Posts: 19474
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

jsmorley » March 21st, 2019, 10:49 pm

As far as I know, these are the error codes returned by PCRE (Perl Compatible Regular Expression)
#define PCRE_ERROR_NOMATCH (-1)
#define PCRE_ERROR_NULL (-2)
#define PCRE_ERROR_BADOPTION (-3)
#define PCRE_ERROR_BADMAGIC (-4)
#define PCRE_ERROR_UNKNOWN_OPCODE (-5)
#define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */
#define PCRE_ERROR_NOMEMORY (-6)
#define PCRE_ERROR_NOSUBSTRING (-7)
#define PCRE_ERROR_MATCHLIMIT (-8)
#define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */
#define PCRE_ERROR_BADUTF8 (-10) /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF16 (-10) /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF32 (-10) /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF8_OFFSET (-11) /* Same for 8/16 */
#define PCRE_ERROR_BADUTF16_OFFSET (-11) /* Same for 8/16 */
#define PCRE_ERROR_PARTIAL (-12)
#define PCRE_ERROR_BADPARTIAL (-13)
#define PCRE_ERROR_INTERNAL (-14)
#define PCRE_ERROR_BADCOUNT (-15)
#define PCRE_ERROR_DFA_UITEM (-16)
#define PCRE_ERROR_DFA_UCOND (-17)
#define PCRE_ERROR_DFA_UMLIMIT (-18)
#define PCRE_ERROR_DFA_WSSIZE (-19)
#define PCRE_ERROR_DFA_RECURSE (-20)
#define PCRE_ERROR_RECURSIONLIMIT (-21)
#define PCRE_ERROR_NULLWSLIMIT (-22) /* No longer actually used */
#define PCRE_ERROR_BADNEWLINE (-23)
#define PCRE_ERROR_BADOFFSET (-24)
#define PCRE_ERROR_SHORTUTF8 (-25)
#define PCRE_ERROR_SHORTUTF16 (-25) /* Same for 8/16 */
#define PCRE_ERROR_RECURSELOOP (-26)
#define PCRE_ERROR_JIT_STACKLIMIT (-27)
#define PCRE_ERROR_BADMODE (-28)
#define PCRE_ERROR_BADENDIANNESS (-29)
#define PCRE_ERROR_DFA_BADRESTART (-30)
#define PCRE_ERROR_JIT_BADOPTION (-31)
#define PCRE_ERROR_BADLENGTH (-32)
#define PCRE_ERROR_UNSET (-33)

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.
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

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

qwerky » March 21st, 2019, 11:02 pm

Thanks for that! :thumbup:

Alas, the weather site has thrown a curve, and I see now that some regex modification is necessary for the (-1) issue. But the (-8) issue is another story, that I'm going to have to dig into. :-(

It seems the weather skin requires constant babysitting! :x
User avatar
jsmorley
Developer
Posts: 19474
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

jsmorley » March 21st, 2019, 11:07 pm

qwerky wrote:
March 21st, 2019, 11:02 pm
Thanks for that! :thumbup:

Alas, the weather site has thrown a curve, and I see now that some regex modification is necessary for the (-1) issue. But the (-8) issue is another story, that I'm going to have to dig into. :-(

It seems the weather skin requires constant babysitting! :x
I find that WXData is pretty consistent, with the following caveat. From time to time their feed will be missing some data. This is just a problem on their end, and really nothing you can do about it. If you use an approach like I do, where you get the entire site as a single "super parent", and then use "parents" to get different sections of the feed, and "children" to return the individual bits, having some part of the information missing in the feed doesn't have to be entirely fatal to the skin. It will get and display what it can, and return empty strings (and yes, an error in the log) for the missing stuff. Generally speaking, WXData will straighten itself out in some matter of minutes, or hours, or a day or two at worst.

https://forum.rainmeter.net/viewtopic.php?f=118&t=23169
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

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

qwerky » March 22nd, 2019, 12:41 am

jsmorley wrote:
March 21st, 2019, 11:07 pm
I find that WXData is pretty consistent, with the following caveat. From time to time their feed will be missing some data. This is just a problem on their end, and really nothing you can do about it. If you use an approach like I do, where you get the entire site as a single "super parent", and then use "parents" to get different sections of the feed, and "children" to return the individual bits, having some part of the information missing in the feed doesn't have to be entirely fatal to the skin. It will get and display what it can, and return empty strings (and yes, an error in the log) for the missing stuff. Generally speaking, WXData will straighten itself out in some matter of minutes, or hours, or a day or two at worst.

https://forum.rainmeter.net/viewtopic.php?f=118&t=23169
:jawdrop Thanks for that! It makes me feel great, because that is exactly what I have done in my own skin, using a single parent to read the site (in my case, https://weather.gc.ca/ specifically for Canadian weather), then other child/parent measures for groups of data, then finally child measures for individual items. :D

It's just that I keep coming across new conditions in the weather feed, that I have to now account for. For example, the season for Wind Chill is pretty much past, but soon there will be a Heat Index or Feels Like item that will need to be worked in. Today, I came across a page that had not one, but two weather alerts; this caused some items to go missing, but as you said, because of the above grouping, it was only a small number of items, and the remainder of the skin continued to display as expected. :great:
User avatar
jsmorley
Developer
Posts: 19474
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

jsmorley » March 22nd, 2019, 12:53 am

So you are making a "Do I need a toque?" skin?
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

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

qwerky » March 22nd, 2019, 1:28 am

jsmorley wrote:
March 22nd, 2019, 12:53 am
So you are making a "Do I need a toque?" skin?
Hmm... I think there was some humour intended there (though I don't see any 'Smiley's), but I'm not sure. Was that a reference to "Canadian" weather? ;-) If so, that would be a "touque", eh? ;-)
Yincognito
Posts: 652
Joined: February 27th, 2015, 2:38 pm

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

Yincognito » March 22nd, 2019, 1:43 am

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)
Many many thanks for that. This will surely be very useful in debugging such errors.
User avatar
jsmorley
Developer
Posts: 19474
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

jsmorley » March 22nd, 2019, 1:44 am

qwerky wrote:
March 22nd, 2019, 1:28 am
Hmm... I think there was some humour intended there (though I don't see any 'Smiley's), but I'm not sure. Was that a reference to "Canadian" weather? ;-) If so, that would be a "touque", eh? ;-)
Drat. My spelling failed me...
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

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

qwerky » March 22nd, 2019, 5:04 pm

jsmorley wrote:
March 22nd, 2019, 1:44 am
Drat. My spelling failed me...
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: