I didn't completely read you post before i posted. But I think I have something for you that might be of interest. Instead of replacing multiple spaces with another character, I have a little trick that will preserve them completely from the edit box.
;/KeepSpaces <window>
;$keepspaces(<window>)
alias KeepSpaces {
;this subs out every character for it's nummeric value, then stores it into a &binvar
bset &tmp $regsubex($editbox($$1-),/(.)/g,$asc(\t) $+ $chr(32))
;dostuff with &tmp. Possibly add it to a hashtable(/hadd -b) to recall later[$hget(table,item,&var)]?
}
Ofcourse, I've left, up to you, how to get the editbox text.
Edited: Fixed typos, added some comments to code