Re: [Tutor] Help on RE

2011-01-23 Thread Albert-Jan Roskam
health, what have the Romans ever done for us? ~~ From: Steven D'Aprano To: tutor@python.org Sent: Sun, January 23, 2011 4:10:35 AM Subject: Re: [Tutor] Help on RE tee chwee liong wrote: >

Re: [Tutor] Help on RE

2011-01-23 Thread Japhy Bartlett
it's a bug in your regex - you want something like "-?\d+" - japhy On Sat, Jan 22, 2011 at 7:38 PM, tee chwee liong wrote: > hi, > > i have a set of data and using re to extract it into array. however i only > get positive value, how to extract the whole value including the -ve sign? > For eg: >

Re: [Tutor] Help on RE

2011-01-22 Thread tee chwee liong
elegant. :) simple yet elegant. > Date: Sun, 23 Jan 2011 14:10:35 +1100 > From: st...@pearwood.info > To: tutor@python.org > Subject: Re: [Tutor] Help on RE > > tee chwee liong wrote: > > thanks for making me understand more on re. re is a confusing topic as i&#

Re: [Tutor] Help on RE

2011-01-22 Thread Steven D'Aprano
tee chwee liong wrote: thanks for making me understand more on re. re is a confusing topic as i'm starting on python. I quote the great Jamie Zawinski, a world-class programmer and hacker: Some people, when confronted with a problem, think 'I know, I'll use regular expressions." Now th

Re: [Tutor] Help on RE

2011-01-22 Thread Steve Willoughby
On Sun, Jan 23, 2011 at 12:38:10AM +, tee chwee liong wrote: > i have a set of data and using re to extract it into array. however i only > get positive value, how to extract the whole value including the -ve sign? > numbers = re.findall("\d+", line) The \d matches a digit character. \d

Re: [Tutor] Help on RE

2011-01-22 Thread tee chwee liong
thanks for making me understand more on re. re is a confusing topic as i'm starting on python. > Date: Sat, 22 Jan 2011 16:55:37 -0800 > From: st...@alchemy.com > To: tc...@hotmail.com > CC: tutor@python.org > Subject: Re: [Tutor] Help on RE > > On Sun, Jan 23, 201

Re: [Tutor] Help on RE

2011-01-22 Thread tee chwee liong
thanks it works!! :) > Date: Sat, 22 Jan 2011 19:51:35 -0500 > Subject: Re: [Tutor] Help on RE > From: ja...@pearachute.com > To: tc...@hotmail.com > CC: tutor@python.org > > it's a bug in your regex - you want something like "-?\d+" > > - japhy

[Tutor] Help on RE

2011-01-22 Thread tee chwee liong
hi, i have a set of data and using re to extract it into array. however i only get positive value, how to extract the whole value including the -ve sign? For eg: Platform: PC Tempt : 25 TAP0 :0 TAP1 :1 + Port Chnl Lane EyVt EyHt +