Another RegEx Question...

andrea.gavana at agip.it andrea.gavana at agip.it
Mon Dec 13 07:58:21 EST 2004


Hello NG,

      I'm quite new to Python and I don't know if this is a FAQ (I can't
find it) or an obvious question. I'm using the RE module in python, and I
would like to be able to contruct something like the Window$ "Find Files Or
Folders" engine. As the Window$ users know, you can filter the file names
using the character "*", as:

myfilen*                 (Will find a file named myfilenames)
*yf*nam*                (Will find a file named myfilenames)

I have tried something like:

import re
mystring = "*yf*nam*"
mystring.replace("*","\w+")
php = re.compile(mystring + "\w+")

But it does not work...

Is there a way to let the user of my application use the "*" character and
to do a Regular Expression search inside a Python code?

Thank you for every suggestion.

Andrea.

------------------------------------------------------------------------------------------------------------------------------------------
 Message for the recipient only, if received in error, please notify the
sender and read http://www.eni.it/disclaimer/





More information about the Python-list mailing list