convert [*] to the n with tab

rev at armbase.com rev at armbase.com
Mon Aug 29 07:12:58 EDT 2005


Quoting Eric Chatonet <eric.chatonet at sosmartsoftware.com>:

> Hi Bob,

Hi Eric and Marielle

Well this just highlights the beauty of runrev.

Get a load of this......
on mouseup
put "[0][0][9]item1[0][0][0][6]item2[0]item3" into tstr
put replacetext(tstr, "(\[[0-9]+\])+", tab)
end mouseup

WOW WOW WOW :-)

Works perfectly

Cheers
Bob; Sunny Glasgow

>
> Thanks.
> But I'm not a regex specialist: did you see Marielle's answer who is  
> far better than mine?
>
>> put "[0][0][9]item1[0][0][0][6]item2[0]item3" into tstr
>> put replacetext(tstr, "(\[[0-9]\])+", tab)
>> get you:     item1    item2    item3
>>
>> [0-9]         Means any number between 0-9
>> \[ and \[     Because [ and ] are characters used to define options  
>> (as the above shows), you need to escape it
>> (something)+  One or more of the same thing.
>>
>> If you can have any number of digits in between square brackets,  then use
>> [0-9]+
>
>
> Le 29 août 05 à 13:04, rev at armbase.com a écrit :
>
>> Quoting Eric Chatonet <eric.chatonet at sosmartsoftware.com>:
>>
>>
>>> Hi Bob,
>>>
>>
>> Hi Eric
>>
>> One again you have saved the day. I ended up with
>>
>> on mouseUp
>> put replaceText(field "preparsed","\[3\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[1\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[2\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[4\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[5\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[6\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[7\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[8\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[9\]","[0]")into field "withtabs"
>> put replaceText(field "withtabs","\[0\]\[0\]\[0\]\[0\]","[0]")into  field
>> "withtabs"
>> put replaceText(field "withtabs","\[0\]\[0\]\[0\]","[0]")into field  
>> "withtabs"
>> put replaceText(field "withtabs","\[0\]\[0\]","[0]")into field  "withtabs"
>> put replaceText(field "withtabs","\[0\]",tab)into field "withtabs"
>> end mouseUp
>>
>> Now works perfect
>>
>> This replaces all the non-[0] with [0] and then changes multiples  
>> of [0] to one
>> single [0]. Then changes them to tab.
>>
>> Cheers
>> Bob
>
>
>
>
>
> Best Regards from Paris,
>
> Eric Chatonet.
> ----------------------------------------------------------------
> So Smart Software
>
> For institutions, companies and associations
> Built-to-order applications: management, multimedia, internet, etc.
> Windows, Mac OS and Linux... With the French touch
>
> Free plugins and tutorials on my website
> ----------------------------------------------------------------
> Web site        http://www.sosmartsoftware.com/
> Email        eric.chatonet at sosmartsoftware.com/
> Phone        33 (0)1 43 31 77 62
> Mobile        33 (0)6 20 74 50 86
> ----------------------------------------------------------------
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>






More information about the use-livecode mailing list