question about find and replace

Mark Schonewille m.schonewille at economy-x-talk.com
Tue Sep 30 03:03:25 CDT 2008


Hi Peter,

Here's a possibility. Perhaps someone can come up with a shorter  
version.

constant dot = "."

function formatDottedNumbers
   set the numberformat to "000"
   set the itemDel to dot
   repeat for each line myLine in myData
     put dot & item 2 of myLine * 1 & dot & cr after myNewData
   end repeat
   return char 1 to -2 of myNewData
end formatDottedNumbers

I believe regex is great to find data, but you can't use it to find  
and edit all instances of a search pattern, if all new values have to  
be different.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum/

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
  for more info.

On 30 sep 2008, at 09:54, Peter Alcibiades wrote:

> How do you pad out a series of numbers with leading zeros?  Like for  
> instance
> the series is
>
> .1.
> .2.
> .3.
> .11.
> .42.
> .98.
>
> and you want them to be
>
> .001.
> .002.
> .003.
> .011.
> .042.
> .098.
>
> I know how to find them, using the fact that they appear as shown  
> between
> two . characters,  but then I don't know how to use regular  
> expressions to
> put part of what has been found back along with the padding zeros.   
> Or should
> you not be trying to use regex at all?  I seem to recall something  
> about look
> ahead and greediness but never really understood it, is this relevant?




More information about the use-livecode mailing list