regEx to remove spaces ?
    Mark Schonewille 
    m.schonewille at economy-x-talk.com
       
    Wed May 17 11:31:38 EDT 2006
    
    
  
Hi JB,
Again, no regex. I looked into regex, but I can't find how to replace  
quoted strings without knowing the whole string in advance. It would  
be great if someone came up with a regex solution for this. In the  
mean time, this function seems to do the job quite nicely:
function decentQuotes theStr
   set the itemDel to space
   repeat for each word myWord in theStr
     if number of items of myWord > 1
     then put quote & word 1 to -1 of (char 2 to -2 of myWord) & ¬
     quote & space after myNewStr else put myWord & space after myNewStr
   end repeat
   return char 1 to -2 of myNewStr
end decentQuotes
Note that it assumes that strings are always surrounded by pairs of  
quotes. Grammar errors are not taken care of.
Best,
Mark
--
Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Salery is the easiest way to get your own web store on-line: http:// 
www.salery.biz/salery.html
Op 17-mei-2006, om 11:45 heeft jbv het volgende geschreven:
> Hi list,
>
> Is it possible to use regEx to remove spaces before and
> after quotes, and, if yes, how ?
>
> Example :
>     my " beautiful " laundrette
> becomes
>     my "beautiful" laundrette
>
> Thanks,
> JB
    
    
More information about the use-livecode
mailing list