convert a string to a regex?

Tim Chase python.list at tim.thechases.com
Wed Nov 18 22:12:29 EST 2009


> There are many special characters listed on
> http://docs.python.org/library/re.html
> 
> I'm wondering if there is a convenient function that can readily
> convert a string with the special characters to its corresponding
> regex. For example,
> 
> "some.thing" => "some\.thing"

Did you try bothering to *read* the page you linked to?

There's a function for escaping strings right there...

Literacy...a worthwhile skill to obtain.

-tkc





More information about the Python-list mailing list