Ohhh dear. Why the hell do you you use $replace() to replace A-Z?
$regsubex(lol this is a test,/(\S)/g,$+($chr(3),,\1))
would be better.