Re: Help me with this!!!

2007-02-01 Thread TOXiC
Peter Otten ha scritto: > TOXiC wrote: > > > Hi all, I've this code: > > No you don't. > ! > > regex = re.compile(r"(?si)(\x8B\xF0\x85\xF6)(?P.*) > > (\xC6\x44\x24)",re.IGNORECASE) > > file = open(fileNa

Help me with this!!!

2007-02-01 Thread TOXiC
Hi all, I've this code: regex = re.compile(r"(?si)(\x8B\xF0\x85\xF6)(?P.*) (\xC6\x44\x24)",re.IGNORECASE) file = open(fileName, "rb") for line in file: if (match): print line file.close() It search a text inside that hex value. It works perfecly on a txt fi

Re: Regex with ASCII and non-ASCII chars

2007-01-31 Thread TOXiC
On 31 Gen, 17:30, "TOXiC" <[EMAIL PROTECTED]> wrote: > It wont work with utf-8,iso or ascii... I think the best way is to search hex value in the file stream but I tryed (in the regex) \hxx but it don't work... -- http://mail.python.org/mailman/listinfo/python-list

Re: Regex with ASCII and non-ASCII chars

2007-01-31 Thread TOXiC
It wont work with utf-8,iso or ascii... -- http://mail.python.org/mailman/listinfo/python-list

Re: Regex with ASCII and non-ASCII chars

2007-01-31 Thread TOXiC
Thx it work perfectly. If I want to query a file stream? file = open(fileName, "r") text = file.read() file.close() regex = re.compile(u"(ÿÿ‹ð…öÂ)", re.IGNORECASE) match = regex.search(text) if (match): result = match.group() print result WritePatch

Regex with ASCII and non-ASCII chars

2007-01-31 Thread TOXiC
Hello everybody. How I can do a regex match in a string with ascii and non ascii chars for example: regex = re.compile(r"(ÿÿ‹ð…öÂty)", re.IGNORECASE) match = regex.search("ÿÿ‹ð…öÂty") if match: result = match.group() print result else: result = "No match fou

Find and replace in a file with regular expression

2007-01-30 Thread TOXiC
Hi everyone, First I say that I serched and tryed everything but I cannot figure out how I can do it. I want to open a a file (not necessary a txt) and find and replace a string. I can do it with: import fileinput, string, sys fileQuery = "Text.txt" sourceText = '''SOURCE''' replaceText = '''REP