2009/6/12 meryl <silverburgh.me...@gmail.com>: > On Jun 11, 9:41 pm, "Mark Tolonen" <metolone+gm...@gmail.com> wrote: >> "meryl" <silverburgh.me...@gmail.com> wrote in message >> >> > I have this regular expression
>... > I try adding ".*" at the end , but it ends up just matching the second > one. If there can be more matches in a line, maybe the non-greedy quantifier ".*?", and a lookahead assertion can help. You can try something like: (?m)Render(?:Block|Table) (?:\(\w+\)|{\w+})(.+?(?=$|RenderBlock))? (?m) multiline flag - also the end of line can be matched with $ .+? any character - one or more (no greedy, i.e. as little as possible) (?=$|RenderBlock) the lookahead assertion - condition for the following string - not part of the match - here the end of line/string or "RenderBlock" I guess, if you need to add more possibilities or conditions depending on your source data, it might get too complex for a single regular expression to match effectively. hth vbr -- http://mail.python.org/mailman/listinfo/python-list