Re: RegEx issues

2009-01-24 Thread Gabriel Genellina
En Sat, 24 Jan 2009 19:03:26 -0200, Sean Brown gmail.com> <" escribió: Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ... above is what I'm interested in extracting which is rea

Re: RegEx issues

2009-01-24 Thread John Machin
On Jan 25, 5:59 am, Scott David Daniels wrote: > Sean Brown wrote: > > I have the following string ...:  "td[ct] = [[ ... ]];\r\n" > > The ... (representing text in the string) is what I'm extracting > > So I think the regex \[\[(.*)\]\]; should do it. > > The problem is it appears that pytho

Re: RegEx issues

2009-01-24 Thread MRAB
Roy Smith wrote: [snip] Another trick when you're not 100% what you're looking at is to explode the string like this: [c for c in reg] > ['\\', '[', '\\', '[', '(', '.', '*', ')', '\\', ']', '\\', ']', ';'] > A shorter way is list(reg). -- http://mail.python.org/mailman/listinfo/python-lis

Re: RegEx issues

2009-01-24 Thread Scott David Daniels
Sean Brown wrote: I have the following string ...: "td[ct] = [[ ... ]];\r\n" The ... (representing text in the string) is what I'm extracting So I think the regex \[\[(.*)\]\]; should do it. The problem is it appears that python is escaping the \ in the regex because I see this: reg = '\[\

Re: RegEx issues

2009-01-24 Thread Roy Smith
Sean Brown wrote: > The problem is it appears that python is escaping the \ in the regex > because I see this: > >>>reg = '\[\[(.*)\]\];' The first trick of working with regexes in Python is to *always* use raw strings. Instead of reg = '\[\[(.*)\]\];' you want reg = r'\[\[(.*)\]\];' In th

Re: RegEx issues

2009-01-24 Thread Steve Holden
Mark Tolonen wrote: > > "Sean Brown" wrote in message > news:glflaj$qr...@nntp.motzarella.org... >> Using python 2.4.4 on OpenSolaris 2008.11 >> >> I have the following string created by opening a url that has the >> following string in it: >> >> td[ct] = [[ ... ]];\r\n >> >> The ... above is wh

Re: RegEx issues

2009-01-24 Thread Mark Tolonen
"Sean Brown" wrote in message news:glflaj$qr...@nntp.motzarella.org... Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ... above is what I'm interested in extracting which is rea

RegEx issues

2009-01-24 Thread Sean Brown
Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ... above is what I'm interested in extracting which is really a whole bunch of text. So I think the regex \[\[(.*)\]\]; should do it.