Hi

I  run a regex like this:

>pchars = re.compile('\x00\x00\x00') #with or without 'r' for raw

on a string like this:

>data = "['broadcast', 'd8on\x00\x00\x00\x11broadcast', 'd11on']"

>print "found pchars :",pchars.findall(data)

which returns: 

>found pchars : ['\x00\x00\x00']


But if I try to match the extra digits at the end like this:

>pchars = re.compile('\x00\x00\x00\x\d+')

I get an error:

>ValueError: invalid \x escape

Or if I use another ide than idle it actually flags it as an "illegal 
hexadecimal escape sequence"


How could I match the \x00\x00\x00\x11 portion of the string?

I have tried escape sequence \\x

Thanks                                    
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to