Re: Help with regex and optional substring in search string

2009-10-14 Thread Timur Tabi
On Wed, Oct 14, 2009 at 10:30 AM, Zero Piraeus 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

Re: Help with regex and optional substring in search string

2009-10-14 Thread Zero Piraeus
: 2009/10/14 Timur Tabi : > Never mind ... I figured it out.  The middle block should have been [\w > \s/]* This is fragile - you'll have to keep adding extra characters to match if the input turns out to contain them. -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regex and optional substring in search string

2009-10-14 Thread Zero Piraeus
: 2009/10/14 Timur Tabi : > I'm having trouble creating a regex pattern that matches a string that > has an optional substring in it.  What I'm looking for is a pattern > that matches both of these strings: > > Subject: [PATCH 08/18] This is the patch name > Subject: This is the patch name > > Wha

Re: Help with regex and optional substring in search string

2009-10-14 Thread Timur Tabi
On Oct 14, 9:51 am, Timur Tabi wrote: > I'm having trouble creating a regex pattern that matches a string that > has an optional substring in it.  What I'm looking for is a pattern > that matches both of these strings: > > Subject: [PATCH 08/18] This is the patch name > Subject: This is the patch