regexp: PCRE error -10 - possible max 5 bug

    May 29 2008 | 12:22 pm
    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?

    • May 29 2008 | 7:23 pm
      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
    • May 29 2008 | 8:37 pm
      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...
    • May 30 2008 | 8:52 am
      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.
    • May 30 2008 | 9:23 am
      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.
    • May 30 2008 | 10:03 am
    • May 30 2008 | 10:19 am
      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.
    • May 30 2008 | 10:56 am
      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...
    • May 30 2008 | 11:07 am
    • Feb 23 2011 | 12:07 pm
      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;- 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.
    • Feb 23 2011 | 2:27 pm
      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: 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.
    • Feb 23 2011 | 2:39 pm
      Sorry about that, Patrick!
      Naughty ASCII.-)
    • Mar 25 2011 | 6:07 pm
      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.
    • Nov 02 2011 | 10:22 am
      for the common good, here is a method to validtae data coming from jit.textfile to jit.str.regexp using [jit.op @op
    • Nov 02 2011 | 11:41 am
      Oops, I posted something here that I meant for here by accident!