Weird problem matching with REs

John S jstrickler at gmail.com
Sun May 29 12:45:02 EDT 2011


On May 29, 12:16 pm, Andrew Berg <bahamutzero8... at gmail.com> wrote:
>
> I've been meaning to learn how to use parenthesis groups.
> > Also, be sure to
> > use a raw string when composing REs, so you don't run into backslash
> > issues.
>
> How would I do that when grabbing strings from a config file (via the
> configparser module)? Or rather, if I have a predefined variable
> containing a string, how do change it into a raw string?
When reading the RE from a file it's not an issue. Only literal
strings can be raw. If the data is in a file, the data will not be
parsed by the Python interpreter. This was just a general warning to
anyone working with REs. It didn't apply in this case.

--john strickler



More information about the Python-list mailing list