I think the re.escape did the trick.
to answer your questions:
By "ignore" i meant instead of using non-alphanumeric characters that have special significance in regular expression (e.g. [|\]) and treat them as normal strings (i.e preceded by \), but since I don't know all the characters in regular expression that have special significance, I don't know which ones to add a '\' infront of.
Thanks anyway

John Machin wrote:
On Jul 21, 3:02 pm, Astan Chee <astan.c...@al.com.au> wrote:
Hi,
I'm reading text from a file (per line) and I want to do a regex using
these lines but I want the regex to ignore any special characters and
treat them like normal strings.
Is there a regex function that can do this?

It would help if you were to say

(1) what "ignore ... characters" means -- pretend they don't exist?
(2) what are "special chararacters" -- non-alphanumeric?
(3) what "treat them like normal strings" means
(4) how you expect these special characters to be (a) ignored and (b)
"treated like normal strings" /at the same time/.

Cheers,
John
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to