Regular expressions

Erik Max Francis max at alcyone.com
Sat Oct 25 20:22:47 EDT 2003


Kill Bill wrote:

> Also, if yipee is a variable, what happens when I do?
> 
> re.search("[yipee]*", line):
> 
> This will treat yipee as a string correct?

Yes, a string literal is a string literal is a string literal.

> I want it to treat yipee
> as a
> variable and perform the different combinations on whatever is inside
> the
> variable.

Then you want "[" + yipee + "]*" or "[%s]*" % yipee.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Defeat is a school in which truth always grows strong.
\__/  Henry Ward Beecher




More information about the Python-list mailing list