\usemodule[pre-30]

\StartSample {Tokens 2}

\startbuffer
\toks0 = {
    Coming back to the use of typefaces in electronic
    publishing: many of the new typographers receive their
    knowledge and information about the rules of typography
    from books, from computer magazines or the instruction
    manuals which they get with the purchase of a PC or
    software. There is not so much basic instruction, as of
    now, as there was in the old days, showing the differences
    between good and bad typographic design. Many people are
    just fascinated by their PC's tricks, and think that a
    widely||praised program, called up on the screen, will make
    everything automatic from now on.
}
\stopbuffer

\setups{show-definition}

\startbuffer
\lua {
    str = tex.toks[0]
    str = string.gsub(str, "\letterpercent w+",
        function(w)
            if str.len(w) > 4 then
                return "\string\\color[red]{" .. w .. "}"
            else
                return "\string\\color[green]{" .. w .. "}"
            end
        end
    )
    tex.toks[0] = str
}

\start \raggedright \scantokens\expandafter{\the\toks0} \par \stop
\stopbuffer

\setups{show-usage}

\StopSample
