HTML issue

Ken Ray kray at sonsothunder.com
Thu Nov 17 15:04:24 EST 2005


On 11/17/05 8:28 AM, "Eric Chatonet" <eric.chatonet at sosmartsoftware.com>
wrote:

> Hi all,
> 
> I want to change the colour of a string in some styled text.
> As the string may be any string like "font", "size", etc. that appear
> in html tags,
> I use the following code that works but I'm not satisfied with it...
> Any more elegant solution?

Yes, you can use regex:

  put the htmlText of fld "Result" into tText
  if matchChunk(tText,"(?s)<font.*?color=\"(.*?)\"",tStart,tEnd) then
    put the uPatternColor of this stack into char tStart to tEnd of tText
  end if
  set the htmlText of fld "Result" to tText

Enjoy!

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list