Problem in Using re.subn()
Fredrik Lundh
effbot at telia.com
Fri Feb 18 08:05:21 EST 2000
More information about the Python-list mailing list
Fri Feb 18 08:05:21 EST 2000
- Previous message (by thread): Problem in Using re.subn()
- Next message (by thread): Problem in Using re.subn()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Joseph C. Kopec <kopecjc at worldnet.att.net> wrote: > SubResult = re.subn('<!-- *** INSERT CONTENT HERE *** -->', Content, > TemplateInput) > I know my Content and TemplateInput values are good strings. sure, but "<!-- *** INSERT CONTENT HERE *** -->" is not a valid regular expression. > Any suggestions would be much appreciated. since you're matching constant strings, why not use string.replace instead: SubResult = string.replace(TemplateInput, '<!-- ... -->', Content) or you can escape the asterisks: "<!-- \*\*\* INSERT CONTENT HERE \*\*\* -->" for more info on regular expressions, see the library refererence (www.python.org/doc) hope this helps! </F> <!-- (the eff-bot guide to) the standard python library: http://www.pythonware.com/people/fredrik/librarybook.htm -->
- Previous message (by thread): Problem in Using re.subn()
- Next message (by thread): Problem in Using re.subn()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list