Use Regex re.sub to remove everything before and including a specified word

后端 未结 3 1152
执笔经年
执笔经年 2021-01-19 00:48

I\'ve got a string, which looks like \"Blah blah blah, Updated: Aug. 23, 2012\", from which I want to use Regex to extract just the date Aug. 23, 2012. I found

3条回答
  •  失恋的感觉
    2021-01-19 01:45

    In this case, you can do it withot regex, e.g:

    >>> date_div = "Blah blah blah, Updated: Aug. 23, 2012"
    >>> date_div.split('Updated: ')
    ['Blah blah blah, ', 'Aug. 23, 2012']
    >>> date_div.split('Updated: ')[-1]
    'Aug. 23, 2012'
    

提交回复
热议问题