## regexp and sprintf

Dec 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...
happy new year !

• Dec 28 2010 | 1:19 pm
Double your escaping slashes and do it in two parts like this and you should be OK:
• Dec 28 2010 | 1:42 pm
Forgot about the symout, thanks very much !
• Dec 28 2010 | 2:21 pm
Surprisingly, it doesn't work !
See the new patch :
• Dec 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...
• Dec 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.
• Dec 28 2010 | 9:33 pm
I got it now, thanks to the regexp masters !