【发布时间】:2016-03-22 22:06:45
【问题描述】:
我需要从一系列格式的字符串中提取月份:
Tue Jan 05 03:29:10 CET 2016
我试过了:
#extracting the second capturing group
sub("([A-z]{3})\\s([A-z]{3})","\\2","Tue Jan 05 03:29:10 CET 2016")
#or just the first whitespace with the Month:
sub("\\s([A-z]{3})","\\2","Tue Jan 05 03:29:10 CET 2016")
我的预期输出,在这种情况下是:
"Jan"
【问题讨论】: