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

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to