Forums > MaxMSP

regexp help

October 14, 2006 | 6:09 am

The semicolon seems to cause an "no such object" error (even if a tosymbol
is before the regexp). Any explanations why?

#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P message 73 375 157 196620 dave ; wack zero ; ok <>;
#P window setfont "Sans Serif" 9.;
#P newex 100 476 75 196617 print backRefs;
#P newex 127 450 82 196617 print substrings;
#P newex 73 507 93 196617 print substitutions;
#P newex 73 415 118 196617 regexp \; substitute " ";
#P connect 4 0 0 0;
#P connect 0 2 2 0;
#P connect 0 1 3 0;
#P fasten 0 0 1 0 78 506;
#P window clipboard copycount 5;

Thanks


October 14, 2006 | 6:43 am

You probably won’t be able to do what you want. Semicolon in message
boxes are used to send messages to receive objects:

#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P message 326 114 43 196617 ; foo 15;
#P number 326 198 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 326 166 32 196617 r foo;
#P connect 0 0 1 0;
#P window clipboard copycount 3;

It is documented somewhere in the documentation, and used extensively
for sending messages to Max itself.

Best,
Trond

Dave Leith wrote:
> The semicolon seems to cause an "no such object" error (even if a
> tosymbol is before the regexp). Any explanations why?


October 14, 2006 | 7:21 am

As Trond mentioned, a single semicolon means something special to
Max. If you want to work with semicolons as text, you need to prepend
them with "", like you have inside of your regexp object. You seem
to have uncovered a different problem though (maybe), because I would
have expected this patch to work properly, and it doesn’t. Will look
into it.

#P window setfont "Sans Serif" 12.;
#P window linecount 3;
#P message 111 61 183 196620 dave\; wack zero\; ok <>;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 164 201 75 196617 print backRefs;
#P newex 191 175 82 196617 print substrings;
#P newex 137 232 93 196617 print substitutions;
#P newex 137 140 126 196617 regexp \; @substitute " ";
#P connect 0 2 2 0;
#P connect 0 1 3 0;
#P connect 0 0 1 0;
#P connect 4 0 0 0;
#P window clipboard copycount 5;

jb

Am 14.10.2006 um 08:09 schrieb Dave Leith:

> The semicolon seems to cause an "no such object" error (even if a
> tosymbol
> is before the regexp). Any explanations why?


October 14, 2006 | 7:25 am

Thanks, should have remembered that.

I was just being lazy using a message box to input text that was being
parsed by regexp. Works fine reading in a file except that regexp will not
output the entire file (stripping html tags) It works fine using regexp @re
< .+?> @substitute " ". Is there somehow a limit of 256 characters that can
be processed? I originally tried jit.regexp but it also seemed to have
problems with very very long lines with no line breaks.

Dave

On 10/13/06, Trond Lossius wrote:
>
> You probably won’t be able to do what you want. Semicolon in message
> boxes are used to send messages to receive objects:
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 2;
> #P message 326 114 43 196617 ; foo 15;
> #P number 326 198 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 326 166 32 196617 r foo;
> #P connect 0 0 1 0;
> #P window clipboard copycount 3;
>
> It is documented somewhere in the documentation, and used extensively
> for sending messages to Max itself.
>
> Best,
> Trond
>
>
> Dave Leith wrote:
> > The semicolon seems to cause an "no such object" error (even if a
> > tosymbol is before the regexp). Any explanations why?
>


Viewing 4 posts - 1 through 4 (of 4 total)