Help with regexp please

Scott David Daniels Scott.Daniels at Acm.Org
Fri Jul 22 00:12:20 EDT 2005


Felix Collins wrote:
> Hi,
>  I'm not a regexp expert and had a bit of trouble with the following search.
> I have an "outline number" system like
> 1
> 1.2
> 1.2.3
> I want to parse an outline number and return the parent.

Seems to me regex is not the way to go:
     def parent(string):
         return string[: string.rindex('.')]



More information about the Python-list mailing list