Re: Reg Expression - Get position of >
On Wed, 26 Nov 2008 01:48:59 -0800 (PST), M_H <[EMAIL PROTECTED]> wrote: > On Nov 25, 11:06 pm, r <[EMAIL PROTECTED]> wrote: >> On Nov 25, 4:33 pm, Jorgen Grahn <[EMAIL PROTECTED]> wrote: ... >> > Depends on if you have an irrational fear of REs or not ... I agree >> > that REs are overused for things which are better done with split, but >> > in this case I think an RE would be clearer. >> >> > >>> re.sub('.*>', '', 'dkjk>djdd') ... > I want to have the end-position of the mimetype tag (position as > mystr.find('>') returns, so I can use the number for a loop) > However, I can't use just the '>' because the character > could also > be in the string of mimetype (I know, actually not in mimetype, but > let's assume it). > So that is why the filter shall be bulletproof and check for '">' - > with possible spaces between both characters. OK. I am too tired to think it through, but if you need to handle nesting brackets or escaped brackets (e.g. ignore brackets inside double-quoted strings) then an RE is not the best solution. /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list
Re: Reg Expression - Get position of >
"Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Wed, Nov 26, 2008 at 1:48 AM, M_H <[EMAIL PROTECTED]> >> >> I have a beginning of a (longer) string who is like: >> mystr = '
Re: Reg Expression - Get position of >
On Wed, Nov 26, 2008 at 1:48 AM, M_H <[EMAIL PROTECTED]> wrote: > On Nov 25, 11:06 pm, r <[EMAIL PROTECTED]> wrote: >> On Nov 25, 4:33 pm, Jorgen Grahn <[EMAIL PROTECTED]> wrote: >> >> >> >> > On Tue, 25 Nov 2008 12:41:53 -0800 (PST), r <[EMAIL PROTECTED]> wrote: >> > > On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: >> > >> Hey, >> >> > >> I need the position of the last char > >> >> > >> Let's say I have a string >> > >> mystr =
Re: Reg Expression - Get position of >
On Nov 25, 11:06 pm, r <[EMAIL PROTECTED]> wrote: > On Nov 25, 4:33 pm, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > > > > > On Tue, 25 Nov 2008 12:41:53 -0800 (PST), r <[EMAIL PROTECTED]> wrote: > > > On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: > > >> Hey, > > > >> I need the position of the last char > > > > >> Let's say I have a string > > >> mystr =
Re: Reg Expression - Get position of >
On Nov 25, 4:33 pm, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > On Tue, 25 Nov 2008 12:41:53 -0800 (PST), r <[EMAIL PROTECTED]> wrote: > > On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: > >> Hey, > > >> I need the position of the last char > > > >> Let's say I have a string > >> mystr =
Re: Reg Expression - Get position of >
On Tue, 25 Nov 2008 12:41:53 -0800 (PST), r <[EMAIL PROTECTED]> wrote: > On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: >> Hey, >> >> I need the position of the last char > >> >> Let's say I have a string >> mystr =
Re: Reg Expression - Get position of >
On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: > Hey, > > I need the position of the last char > > > Let's say I have a string > mystr =
Re: Reg Expression - Get position of >
On Tue, Nov 25, 2008 at 8:36 AM, M_H <[EMAIL PROTECTED]> wrote: > > Hey, > > I need the position of the last char > > > Let's say I have a string > mystr =