regexp: PCRE error -10 - possible max 5 bug
Hi All,
I've created a patcher in max 5 that uses hi to create menu of connected devices and I output this to regexp to find devices of specific types (with the possibility of more than one of t he same type). The search works fine, so that's not the problem, but I keep getting an annoying error message in the max window every time I do the search- regexp: PCRE error -10. Maybe if I wasn't so anal this wouldn't bother me, as the patcher still seems to work ok. But that's just the way I am... so it does. I've looked up perl error codes, and apparently error -10 isn't used... hmmm.
Basically my patcher sends a "menu" message to the hi object. The right output is connected to a regexp "Apple Internal Keyboard / Trackpad 2" with the third regexp output printing to the max window. I've attached the maxpat to see if anybody else gets the same error message.
The same patcher recreated for max 4.6.3 works fine with no error messages, so I reckon its a max 5 bug.
I've also tried creating a list from the hi output and sending that to regexp instead and I get the same error message, unless I edit the message manually and resend it. Voila no error. Wierd. Possibly something to do with the "end of line" or some other hidden character for each string being sent to regexp?
Cheers,
David
I don't see this error here on either Mac or PC.
Are you using Max 5.0.2? If not, please update. What OS/computer model are you running?
-Ben
Cycling '74 Support
Sorry Ben, forgot to say...
I am running max 5.0.2 on a OSX 10.4.11 macbook pro.
I just tried the file I sent as an attachment on my mbpro and it worked fine... strange. Could it be something to do with the 2 monitor setup I have at work? - this has previously caused max 5.0.2 to crash over the most bizarre things. I'll test a few things out tomorrow and report back. No error message without the 2nd monitor at the moment though...
Cheers,
David
OK back at work. Just plugged in all my usual - lcd monitor, usb hub with keyboard, mouse, etc. Error message back again...
By unplugging everything and replacing one at a time (restarting max each time) I have whittled it down to a problem with my microsoft wireless mouse. The hi object detects it as "Microsoft Wireless Optical Mouse( 1.00". Something to do with the lack of close bracket, maybe?
Oh well. At least I know what it is now and can safely ignore it. Thanks again, Ben, for helping out - just needed to know if it was a problem with max or my setup.
Cheers,
David
The problem is likely the unescaped '(' since '(' is a magic character when forming regular expressions. But if you can make a simple patch which demonstrates the input which causes the error, I could see better if there is, in fact, a regexp problem.
jb
Maybe you can simply write in a comment or in a message to this forum, what exactly is coming out of 'hi', so I can type it into a message box and send it to the regexp object you sent previously.
jb
The non utf-8 character conversion I mentioned appears to have changed the "(" to a "*" in the text I sent:
> "text" : ""Microsoft Wireless Optical Mouse* 1.00" S
So you won't get the error message if you try it...
D
I stumbled across this thread Googling on "PCRE Error 10". It may actually be an issue with the hi object.
A simple patch demoing the error message below. Note that on my configuration, the error is documented with these two lines in the Max window
symbolToRegexp: Peter Castines Mouse
regexp: regexp: PCRE error -10
The device in question is listed in the Bluetooth menu as "Peter Castine’s Mouse" ('smart' apostrophe between my last name and the possessive s). The hi object seems to be replacing the apostrophe character with something else. FWIW, I sent the relevant symbol through a spell object, and the critical character was converted as ASCII 213. I'm not even sure if this is valid UTF-8. In any case it's not the character it's supposed to be.
Before I get tsuris for having named my HID with non-7bit-ASCII, Microsoft did it, too, and Microsoft is always right;-
USB.org lists some guidelines for dealing with Unicode, but I have no idea if anyone follows them.
Does any of this shed light on the regexp error message?
PS/Edit: I copy/pasted from the Max Window into the forum message panel, but the offending character was changed when posting the message to the forum. Don't hang onto the specific text chars, it seems to simply be some sort of voodoo in hi's processing of >127 ASCII/Unicode.
Hallo Peter,
since you posted this mail, Thunderbird can't update the RSS feed of this forum...
Here is the error message in TB's console:
Error: not well-formed
Source File: https://cycling74.com/forums/rss.php?forum=1
Line: 426, Column: 41
Source Code:
symbolToRegexp: Peter Castines Mouse
with an arrow pointing to the offending apostrophe.
I already warned c74 about those pesky ascii codes and asked to filter them out , but it seems they didn't do it.
Now, once again I need to wait until the code is removed from the feed.
Sorry about that, Patrick!
Naughty ASCII.-)
Hi, I also found this thread trying to get a patch to work. Thanks to Peter Castine's post I finally found out what was goning on.
"PCRE Error -10" is produced by regexp when it receives a character with an ASCII or rather UTF-8 value lager than 127.
This patcher shows the issue:
Somehow a non-ASCII character had gotton into a message in my patcher and was causing the trouble. I was not able to see it in any message box. I could only detect it by using the 'itoa' object.
for the common good,
here is a method to validtae data coming from jit.textfile to jit.str.regexp using [jit.op @op