Re: [Tutor] Question about an re

2005-10-28 Thread Kent Johnson
w chun wrote: >>- ->: \d+/?\d* >>- -> >>- ->ie 1 or more digits followed by 0 or 1 slashes followed by 0 or more >>digits. > > > > this looks like it'll also accept invalid data, such as "1/" ... i > think there's some more tweaking involved to get it so that if there's > a '/', there is at lea

Re: [Tutor] Question about an re

2005-10-28 Thread w chun
> - ->: \d+/?\d* > - -> > - ->ie 1 or more digits followed by 0 or 1 slashes followed by 0 or more > digits. this looks like it'll also accept invalid data, such as "1/" ... i think there's some more tweaking involved to get it so that if there's a '/', there is at least one digit afterwards. -

Re: [Tutor] Question about an re

2005-10-27 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Today (Oct 27, 2005) at 9:29am, Ed Singleton spoke these wise words: - ->OR tests for the truth of the first thing then the truth of the second. - -> - ->The first part of your OR is always true, so it doesn't test the second. - -> - ->What you reall

Re: [Tutor] Question about an re

2005-10-27 Thread Ed Singleton
OR tests for the truth of the first thing then the truth of the second. The first part of your OR is always true, so it doesn't test the second. What you really want to do is look for a digit and then look for more digits or a slash and some more digits. So: : \d(\d+|/\d+) but this is easier b

[Tutor] Question about an re

2005-10-26 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 os - Slackware py - 2.4.1 I'm trying to grab the value 10 in Visibility: 10 mile(s):0 but sometimes the value looks like Visibility: 1/2 mile(s):0 My not working regex looks like re.compile(': \d+|: \d/\d') If I'm understanding right, this shou