matchChunk to find fontNames
Marielle Lange
M.Lange at ed.ac.uk
Thu Jun 23 05:10:36 EDT 2005
Hi Claudi,
You are on the right track... but you need to tune your regular expressions a
bit.
Problem 1: $ means end of the line (not end of the chunk)
Problem 2: \" works with perl and unixy languages. I found it not to work with
revolution. I usually use "<font face=" & quote & ". Possibly "\"" is ok in the
most recent versions.
Info: sometimes, it's a better strategy to list the characters that you don't
want rather than the characters that may occur. For this use [^], where ^ means
none of the single character that follows.
<font face=\"([^\"]+)\">"
(replace each _\"_ with _" & quote & "_ if this doesn't work)
>Some fontNames have spaces or - in theire name but if I add them to the
>regex like in the above example
>the end goes on to far like: Stone Sans OS ITC TT-Bold"
>color="#FF0000">zeker</font> . . . . . . etc
>I tried to change the regex part with a $ at the end so it should stop
>at the ">" char.
matchChunk(tText, "(<font face=\"[A-z\- ]+\">$)", tStart, tEnd)
>Well, no dice, now it finds nothing no more so obviously I am doing
>something wrong. How should this be done?
>Sugestions for a better way to find all the style runs are of course
>very welcome as well, since I just "thought" of this way to do it, in fact
>after quite some thought this came as "best" solution to my mind, but wether
>this is the best way to do it, well probably not.
More information about the use-livecode
mailing list