Help with regexp please

Terry Hancock hancock at anansispaceworks.com
Fri Jul 22 10:36:05 EDT 2005


On Thursday 21 July 2005 11:39 pm, Felix Collins wrote:
> Christopher Subich wrote:
> > Scott David Daniels wrote:
> Thanks to you both.  Wow!  what a quick response!
>  >string.rsplit('.',1)[0]
> Clever Python!  ;-)
> Sorry, I mainly code in C so I'm not very Pythonic in my thinking.
> Thanks again...

I think this is the "regexes can't count" problem.  When the repetition
count matters, you usually need something else.  Usually some
combination of string and list methods will do the trick, as here.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list