Storing/Retrieving python raw strings in a database
Laura Arbilla
larbilla at clickfeed.com
Wed Aug 2 11:45:19 EDT 2000
More information about the Python-list mailing list
Wed Aug 2 11:45:19 EDT 2000
- Previous message (by thread): Storing/Retrieving python raw strings in a database
- Next message (by thread): Embedded python: how to force a break to endless looping Python script?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This is what I'm doing: User types a regular expression (in python raw string syntax) in my html form, which is written in php: http://www\.foo\.com I store this reg exp in a mySQL database, the value in the database is: http://www\\.foo\\.com because single backslashes should be doubled when stored in mySQL. Later, in a different process, I read the database value using python: print `valueRead` prints: 'http://www\\\\.foo\\\\.com' print valueRead prints: http://www\\.foo\\.com Now,I built an re object using the "valueRead": re.compile(valueRead) and now the following string doesn't match, when it should: http://www.foo.com I tried to replace the double backslashes with a single in valueRead, but this brakes in other cases where a back slash is used to scape double quotes in the database (\") Can somebody help me here? I really need a way to convert the contents of a python string variable into an equivalent raw string that I can use as a regular expression. I searched the FAQ and news groups and didn't find an answer. Sorry if this question is duplicated. I appreciate any help you can provide, Laura. larbilla at clickfeed.com
- Previous message (by thread): Storing/Retrieving python raw strings in a database
- Next message (by thread): Embedded python: how to force a break to endless looping Python script?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list