#this script is an example of using regular expressions to perform word segmentation #the result word$[i] array contains all the words (five in this case) a$="gu3 cheng2 you4 xiang1 feng2 , " l = length(a$) c=0 tem$=a$ k=1 letter$=mid$(a$,k,1) while letter$!="," if letter$=" " c+=1 endif k+=1 letter$=mid$(a$,k,1) endwhile printline there are 'c' words for i to c div=index_regex(tem$,"\d") printline div='div' word$ [i] = left$(tem$, 'div') printline count='c' len=length(tem$) tem$=right$ (tem$, 'len'-'div'-1) endfor for j to c appendInfoLine("the word is ", word$[j]) endfor