Re: Regular expression issue

2010-08-09 Thread genxtech
I have it now. Had to beat my head over it a couple times. Thanks everybody. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression issue

2010-08-09 Thread nn
On Aug 9, 9:18 am, genxtech wrote: > On Aug 8, 7:34 pm, Tim Chase wrote: > > > > > On 08/08/10 17:20, genxtech wrote: > > > > if re.search(search_string, in_string) != None: > > > While the other responses have addressed some of the big issues, > > it's also good to use > > >    if thing_to_test

Re: Regular expression issue

2010-08-09 Thread MRAB
genxtech wrote: On Aug 8, 7:34 pm, Tim Chase wrote: On 08/08/10 17:20, genxtech wrote: if re.search(search_string, in_string) != None: While the other responses have addressed some of the big issues, it's also good to use if thing_to_test is None: or if thing_to_test is not None: i

Re: Regular expression issue

2010-08-09 Thread genxtech
On Aug 8, 7:34 pm, Tim Chase wrote: > On 08/08/10 17:20, genxtech wrote: > > > if re.search(search_string, in_string) != None: > > While the other responses have addressed some of the big issues, > it's also good to use > >    if thing_to_test is None: > > or > >    if thing_to_test is not None: >

Re: Regular expression issue

2010-08-08 Thread Tim Chase
On 08/08/10 17:20, genxtech wrote: if re.search(search_string, in_string) != None: While the other responses have addressed some of the big issues, it's also good to use if thing_to_test is None: or if thing_to_test is not None: instead of "== None" or "!= None". -tkc -- http://ma

Re: Regular expression issue

2010-08-08 Thread Chris Rebert
On Sun, Aug 8, 2010 at 3:32 PM, Thomas Jollans wrote: > On Monday 09 August 2010, it occurred to genxtech to exclaim: >> I am trying to learn regular expressions in python3 and have an issue >> with one of the examples I'm working with. >> The code is: >> >> #! /usr/bin/env python3 >> >> import re

Re: Regular expression issue

2010-08-08 Thread MRAB
genxtech wrote: I am trying to learn regular expressions in python3 and have an issue with one of the examples I'm working with. The code is: #! /usr/bin/env python3 import re search_string = "[^aeiou]y$" You can think of this as: a non-vowel followed by a 'y', then the end of the string.

Re: Regular expression issue

2010-08-08 Thread Thomas Jollans
On Monday 09 August 2010, it occurred to genxtech to exclaim: > I am trying to learn regular expressions in python3 and have an issue > with one of the examples I'm working with. > The code is: > > #! /usr/bin/env python3 > > import re > > search_string = "[^aeiou]y$" To translate this expressi

Regular expression issue

2010-08-08 Thread genxtech
I am trying to learn regular expressions in python3 and have an issue with one of the examples I'm working with. The code is: #! /usr/bin/env python3 import re search_string = "[^aeiou]y$" print() in_string = 'vacancy' if re.search(search_string, in_string) != None: print(" ay, ey, iy,

Re: Regular expression issue

2010-02-25 Thread Peter Otten
Ashok Prabhu wrote: > The following is a sample of my problem. I get input from user and > store it in variable 'b'. I want to match the user input with the > contents of another variable 'a'. However I m not able to get the > exact match. Could someone help? > print a > c > c+ > b > '

Regular expression issue

2010-02-24 Thread Ashok Prabhu
Hi, The following is a sample of my problem. I get input from user and store it in variable 'b'. I want to match the user input with the contents of another variable 'a'. However I m not able to get the exact match. Could someone help? >>> print a c c+ >>> b 'c+' >>> re.search(b,a).group() 'c'

Re: Regular expression issue

2006-07-24 Thread Sibylle Koczian
[EMAIL PROTECTED] schrieb: > I'm trying to parse a line of html as follows: > > 101.120:( KPA (-) > Snow on Ground)0 > > however, sometimes it looks like this: > > N/A > Snow on Ground)0 > > > I want to get either the numerical value 101.120 (which could be a > different number depending on

Re: Regular expression issue

2006-07-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, dmbkiwi wrote: > I'm trying to parse a line of html as follows: > > 101.120:( KPA (-) > Snow on Ground)0 > > however, sometimes it looks like this: > > N/A > Snow on Ground)0 > > > I want to get either the numerical value 101.120 (which could be a > different number

Regular expression issue

2006-07-19 Thread dmbkiwi
I'm trying to parse a line of html as follows: 101.120:( KPA (-) Snow on Ground)0 however, sometimes it looks like this: N/A Snow on Ground)0 I want to get either the numerical value 101.120 (which could be a different number depending on the data that's been fed into the page, or in terms o