Help with regex and optional substring in search string

Timur Tabi timur at
Thu Oct 15 00:22:35 CEST 2009

On Wed, Oct 14, 2009 at 10:30 AM, Zero Piraeus <schesis at> wrote:

> '(?:etc)' instead of '(etc)' are non-grouping parentheses (since you
> apparently don't care about that bit).

Ah yes, thanks.

> '[^\]]' instead of '[\w\s]' matches "everything except a closing bracket".

I originally had just '[^\]', and I couldn't figure out why it
wouldn't work.  Maybe I need new glasses.

> The '\s*' before the second set of parentheses takes out the leading
> whitespace that would otherwise be returned as part of the match.

And I want that.  The next line of my code is:

description = + "\n\n"

Timur Tabi
Linux kernel developer at Freescale

More information about the Python-list mailing list