regex - Extracting dates from text using python and regular expressions where the dates are in the form october 12 - 2010 -


i extract dates following text:

some text more text october 12 - 2010

the result be:

yyyy-mm-dd: 2010-10-12

how can tell regex month words , can "january", "february" etc single space, [a group of 1-2 characters] space , final [group of 4 digits \d{4}]

writing out actual names of months in regex makes readable , maintainable expression, feel important when comes regexes. so:

(january|february|march|april|may|june|july|august|september|october|november|december)\s\d{1-2}\s\d{4} 

Comments

Popular posts from this blog

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -