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>dj>>>>dd') ... > 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 <grahn@ Ph'nglui mglw'nafh Cthulhu \X/ snipabacken.se> R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list