Sorting lines on colour (color for some)

Thierry Douez th.douez at gmail.com
Thu Sep 18 15:55:43 EDT 2014


2014-09-18 20:26 GMT+02:00 Peter Haworth <pete at lcsql.com>:

> Like that better than mine - good use of htmltext and regex!

> Pete

Thanks Peter,

and for those having real headacke with regex, you can write
the function this way:

function getHtmlColors L
   if offset( "<p bgcolor=", L) < 1 then return "z"
   return char 12 to 18 of L -- the 6 hexa chars
end getHtmlColors


But I personaly find it extremely ugly :)

Regards,

Thierry


> On Thu, Sep 18, 2014 at 11:01 AM,
Thierry Douez <th.douez at gmail.com> wrote:
>
>> Another one with some regex flavor
>>
>> on mouseUp
>>    local t
>>    put the htmltext of fld 1 into t
>>    sort lines of t  by getHtmlColors( each)
>>    set  the htmltext of fld 1 to t
>> end mouseUp
>>
>> function getHtmlColors L
>>    if matchText( L, "<p bgcolor=.#([0-9A-F]{6}).>", v) then  return v
>>    return "z"
>> end getHtmlColors
>>
>> Thierry



------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage




More information about the use-livecode mailing list