Reg Expression - Get position of >

r rt8396 at gmail.com
Tue Nov 25 15:41:53 EST 2008


On Nov 25, 10:36 am, M_H <heyer.ma... at googlemail.com> wrote:
> Hey,
>
> I need the position of the last char >
>
> Let's say I have a string
> mystr =  <mimetype="text/html"><content><![CDATA[
>
> I need the posistion of the "> (second sign) - so I can cut away the
> first part.
>
> The problem is that it can be like "> but also like " > or "     >
>
> But it is def the quotes and the closing brakets.
>
> How do I get the position of the >  ????
>
> Hope you can help,
> Bacco

why not just spilt

>>> mystr =  '<mimetype="text/html"><content><![CDATA['
>>> mystr.split('>', 2)[-1]
'<![CDATA['

you don't want to use an re for something like this





More information about the Python-list mailing list