Hi All,

I have a list of regular expressions under a file(EX: inp.txt). Then, I have
another file (EX: search.txt).The task is that i have to read the list of
regular expressions from the inp.txt and then search for the same in
"search.txt" and output the matched string.

Iam using python *"re" *module to do this.

This works except for few regular expressions below.

*a = '(/|\\)cmd\.com$'*

1.
When i read the regular expression above from the file to a variable *(EX:
a)*. as below
EX:
*a=open('inp.txt','r').readlines()[0]*

Iam getting a different regular expresson as  *'(/|\\\\)cmd\.com$'*

2. Instead when i use *a.encode('string-escape')*, iam getting the output
for a as * '(/|\)cmd\.com$' *So when used like this, re.compile() statement
gives an error


Any idea to solve this.

Thx,
Santhosh


Thx,
Santhosh
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to