I am working on a script to cleanup .rtf message formatting and cannot figure out why this regsub statement is only replacing 1 occurance of the string when the condition exists multiple times. I am trying to find the {xxxx } where xxxx can be anything and insert a space between xxxx and }. This is a pain because the backslash and curly brace are part of the text but also affect the syntax for the regexp.
Example:
set text “DATE}{\fs24 }{\fs24 FIRST}{\fs24 }{\fs24 SEEN:}”
echo $text
regsub -all — {({B.*)(s})} $text {1 2} text
echo $text
Result:
DATE}{fs24 }{fs24 FIRST}{fs24 }{fs24 SEEN:}
DATE}{fs24 }{fs24 FIRST}{fs24 }{fs24 SEEN:}
Any ideas would be helpful because I’ve tried every combination I can think of.
Thanks!!