Dynamic text color

Dave McCormick mackrackit at gmail.com
Fri Jan 8 19:37:41 CET 2010


On Wed, Jan 6, 2010 at 9:18 AM, John Posner <jjposner at optimum.net> wrote:

> On Tue, 05 Jan 2010 16:54:44 -0500, Dave McCormick <mackrackit at gmail.com>
> wrote:
>
>  But it is not what I am wanting. I first thought to make it look for a
>> space but that would not work when a single character like "#" is to be
>> colored if there is a "string" of them.  Or if all of the characters between
>> quotes are to be colored.
>>
>
> Regular expressions are good at handling searches like:
>
> * all the characters between quotes
> * the two-character string "do", but only if it's a complete word
>
> -John
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
I need another hint...

Been doing some reading and playing and it looks like
r'\bxxx\b'
is what I need. But I can not figure out how to pass a variable between
\b___\b
If the word in question is between the "\b \b" and in the list then it works
like I want it to.
 The below does not work.

    greenList_regexp = "|".join(greenList)
    for matchobj in re.finditer(r'\bgreenList_regexp\b', complete_text):
        start,end = matchobj.span()

Thanks,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100108/3e305e90/attachment.html>


More information about the Python-list mailing list