Re: Strange re problem

2008-06-21 Thread TYR
On Jun 20, 3:35 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jun 20, 6:01 am, TYR <[EMAIL PROTECTED]> wrote: Thank you very much. This pyparsing module looks damned useful. -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange re problem

2008-06-20 Thread Paul McGuire
On Jun 20, 6:01 am, TYR <[EMAIL PROTECTED]> wrote: > OK, this ought to be simple. I'm parsing a large text file (originally > a database dump) in order to process the contents back into a SQLite3 > database. The data looks like this: > > 'AAA','PF',-17.4167,-145.5,'Anaa, French Polynesia','

Re: Strange re problem

2008-06-20 Thread John Machin
On Jun 20, 10:33 pm, TYR <[EMAIL PROTECTED]> wrote: > >How do you propose to parse that string into a "set of values"? Can > >you rely there being data commas only in the 5th field, or do you need > >a general solution? What if (as Peter remarked) there is a ';' in the > >data? What if there's a "

Re: Strange re problem

2008-06-20 Thread TYR
>How do you propose to parse that string into a "set of values"? Can >you rely there being data commas only in the 5th field, or do you need >a general solution? What if (as Peter remarked) there is a ';' in the >data? What if there's a "'" in the data (think O'Hare)? My plan was to be pointlessl

Re: Strange re problem

2008-06-20 Thread John Machin
On Jun 20, 9:01 pm, TYR <[EMAIL PROTECTED]> wrote: > OK, this ought to be simple. I'm parsing a large text file (originally > a database dump) in order to process the contents back into a SQLite3 > database. The data looks like this: > > 'AAA','PF',-17.4167,-145.5,'Anaa, French Polynesia','

Re: Strange re problem

2008-06-20 Thread Mel
TYR wrote: > OK, this ought to be simple. I'm parsing a large text file (originally > a database dump) in order to process the contents back into a SQLite3 > database. The data looks like this: > > 'AAA','PF',-17.4167,-145.5,'Anaa, French Polynesia','Pacific/ > Tahiti','Anaa';'AAB','AU',-

Re: Strange re problem

2008-06-20 Thread Peter Otten
TYR wrote: > OK, this ought to be simple. I'm parsing a large text file (originally > a database dump) in order to process the contents back into a SQLite3 > database. The data looks like this: > > 'AAA','PF',-17.4167,-145.5,'Anaa, French Polynesia','Pacific/ > Tahiti','Anaa';'AAB','AU',-

Strange re problem

2008-06-20 Thread TYR
OK, this ought to be simple. I'm parsing a large text file (originally a database dump) in order to process the contents back into a SQLite3 database. The data looks like this: 'AAA','PF',-17.4167,-145.5,'Anaa, French Polynesia','Pacific/ Tahiti','Anaa';'AAB','AU',-26.75,141,'Arrabury, Que

Re: Strange re problem on OSX but Not Linux

2006-11-08 Thread Brian
Paul McGuire wrote: > "Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Dont use regex as a name. Also, do you have any script called "re.py" > > hidding that library module? or regex.py? > > My bet is that a local re.py is masking the lib module. (It's a shame

Re: Strange re problem on OSX but Not Linux

2006-11-08 Thread Paul McGuire
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dont use regex as a name. Also, do you have any script called "re.py" > hidding that library module? or regex.py? My bet is that a local re.py is masking the lib module. (It's a shame this error is so easy to tri

Re: Strange re problem on OSX but Not Linux

2006-11-08 Thread Gabriel Genellina
At Wednesday 8/11/2006 15:01, Brian wrote: I have a very small script: import re text = open('eq.txt','r').read() regex = '[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]' pattern = re.compile(regex) match = pattern.findall(text) print ''.join(match) -

Strange re problem on OSX but Not Linux

2006-11-08 Thread Brian
I have a very small script: import re text = open('eq.txt','r').read() regex = '[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]' pattern = re.compile(regex) match = pattern.findall(text) print ''.join(match) However, when I try to run it, I get this error: Traceback (most recent call last): File "/Appli