regEx to remove spaces

John Craig jc at spl21.net
Fri May 19 05:11:56 EDT 2006


Here's a small snippet that will replace spaces within quotes using 
regex's.  Just put your data into tString and the new data is put into 
tResult.

repeat while matchText(tString, "([" & quote & "][^" & quote & "]+[" & 
quote & "])", tMatch)
    put replaceText(tMatch, " ", "") into tReplacement
    put replaceText(tString, tMatch, tReplacement) into tResult
    put replaceText(tString, tMatch, "") into tString
end repeat

Hope this is of use, JB.

JC

+-------------------------------------------------------------------------------------------------+
|  There are 10 types of people in this world - those who understand 
binary and those who don't   |
+-------------------------------------------------------------------------------------------------+





More information about the use-livecode mailing list