On 19/06/2006 7:06 PM, Kay Schluehr wrote: > Mirco, > > with "special characters" I mentioned control characters of regular > expressions i.e. one of ".^$()?[]{}\|+*" but not non ascii-127 > characters. > > For a workaround you simply have to "mangle" those using an escape > control character: > > REGEXCHAR = ".^$()?[]{}\\|+*" > def mangle(s): > pattern = [] > for c in s: > if c in REGEXCHAR: > pattern.append("\\") > pattern.append(c) > return "".join(pattern) >
What's wrong with re.escape()? Have you not read (a) my response to Paddy's first posting (b) the manual? -- http://mail.python.org/mailman/listinfo/python-list