regexp and sprintf
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 !
Double your escaping slashes and do it in two parts like this and you should be OK:
Forgot about the symout, thanks very much !
Surprisingly, it doesn't work !
See the new patch :
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...
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.
I got it now, thanks to the regexp masters !