Forums > MaxMSP

regexp and sprintf

December 28, 2010 | 12:45 pm

Hi list,

I’m having trouble to format a message for regexp. I use jit.str.regexp to search for an exact word in a dictionary using the \b \b tags but I can’t format it using sprintf as it get rids of the \ characters. I have also tried jasch’s strcat but it gives me a symbol and once I want to remove the symbol I not only loose the "" but also the \ tags. Help appreciated !

A patch is better than a 1000 words…

– Pasted Max Patch, click to expand. –

happy new year !


December 28, 2010 | 1:19 pm

Double your escaping slashes and do it in two parts like this and you should be OK:

– Pasted Max Patch, click to expand. –

December 28, 2010 | 1:42 pm

Forgot about the symout, thanks very much !


December 28, 2010 | 2:21 pm

Surprisingly, it doesn’t work !

See the new patch :

– Pasted Max Patch, click to expand. –

December 28, 2010 | 3:33 pm

More surprises ! The symout doesn’t work in this situation, even if the message display looks correct. By using with , it works (even if the message display doesn’t look correct…)

Can anyone explain ? See patch…

– Pasted Max Patch, click to expand. –

December 28, 2010 | 5:24 pm

If you use sprintf symout \\b%s\\b what you passe to the regexp object is \bessai\b. If you use sprintf \\b%s\\b, the string output by sprintf is bessaib. The correct approach is the sprintf symout \b%s\b.


December 28, 2010 | 9:33 pm

I got it now, thanks to the regexp masters !


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