python regex of a date in some text, enclosed by two keywords

Posted by Horace Ho on Stack Overflow See other posts from Stack Overflow or by Horace Ho
Published on 2010-05-05T02:27:16Z Indexed on 2010/05/05 2:38 UTC
Read the original article Hit count: 284

Filed under:
|
|

This is Part 2 of this question and thanks very much for David's answer. What if I need to extract dates which are bounded by two keywords?

Example:

text = "One 09 Jun 2011 Two 10 Dec 2012 Three 15 Jan 2015 End"

Case 1 bounding keyboards: "One" and "Three"
Result expected: ['09 Jun 2011', '10 Dec 2012']

Case 2 bounding keyboards: "Two" and "End"
Result expected: ['10 Dec 2012', '15 Jan 2015']

Thanks!

© Stack Overflow or respective owner

Related posts about python

Related posts about regex