Hello Arie,
I use the code below in the whenever modifying section of the edit box;
IF Length(MySelf)="" THEN RETURN
MySelf..DisplayEnabled = False
let nCur = MySelf..Cursor - CharactTypeOccurrence(MySelf[[TO MySelf..Cursor]],ctPunctuation)
MySelf = StringFormat(MySelf,ccIgnorePonctuationAndSpace)
let n = 1
let nType = CharactType(MySelf[[n]])
let nCount = 0
WHILE n <= Length(MySelf)
IF CharactType(MySelf[[n]]) <> nType THEN // Character type changed
nType = CharactType(MySelf[[n]])
MySelf[[n]]="-"+MySelf[[n]]
nCount=1
IF nCur>n THEN nCur++
n++
ELSE
IF nCount = 3 THEN // A series of 4 characters of the same type: add separator
MySelf[[n-1]]="-"+MySelf[[n-1]]
nCount=1
IF nCur>n THEN nCur++
n++
ELSE
nCount++
END
END
n++
END
MySelf..Cursor = nCur
MySelf..DisplayEnabled = True