On Oct 14, 9:51 am, Timur Tabi <timur.t...@gmail.com> 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 name
>
> What I want is to extract the "This is the patch name".  I tried this:
>
> m = re.search('Subject:\s*(\[[\w\s]*\])*(.*)', x)

Never mind ... I figured it out.  The middle block should have been [\w
\s/]*

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to