regEx to remove spaces ?

jbv jbv.silences at club-internet.fr
Thu May 18 05:24:49 EDT 2006


many thanks to all list members who responded to my question.

actually I had already cooked my own script (see below - not
really elegant, but efficient & fast enough for what I need to do).
I was just wondering if it could be done in a simpler way with
a regEx...

Best,
JB


  put "" into myL
  put 0 into mySkip
  put 0 into x
  repeat forever
    get offset(quote,myTXT,mySkip)
    if it=0 then
      exit repeat
    end if

    add it to mySkip
    put mySkip & "," after myL
    add 1 to x
    if x=2 then
      put cr into last char of myL
    end if
  end repeat

  repeat with j=number of lines of myL down to 1
    put line j of myL into a
    get (item 2 of a)-1
    if char it of myTXT=" " then
      delete char it of myTXT
    end if
    get 1+(item 1 of a)
    if char it of myTXT=" " then
      delete char it of myST
    end if
  end repeat




More information about the use-livecode mailing list