[BangPypers] Regular Expressions
orsenthil at gmail.com
Thu Mar 17 03:36:48 CET 2011
On Wed, Mar 16, 2011 at 11:27:24PM +0530, Santhosh Edukulla wrote:
> a = '(/|\\)cmd\.com$'
> When i read the regular expression above from the file to a variable *(EX:
> a)*. as below
> Iam getting a different regular expresson as *'(/|\\\\)cmd\.com$'*
I think, you were trying this in the interpreter and you were using
the interpreter to check the regex output. I got tripped by it too,
and had to take help from IRC.
Look at this session:
>>> f = open('inp.txt')
>>> c = f.read()
>>> # That is because it is doing a repr(c)
>>> # But do a print, you will see
>>> print c
Does this help?
More information about the BangPypers