【发布时间】:2018-11-14 01:13:46
【问题描述】:
我有10000 描述,我想使用正则表达式来提取与短语“被捕”相关的数字。
例如:
"police arrests 4 people"
"7 people were arrested".
数字范围为1-99。
我已经尝试了以下代码:
gen arrest= regexm(description, "(^[1-9][0-9]$)[ ]*(arrests|arrested)")
我不能简单地提取数字,因为描述中还提到了与逮捕无关的数字。
【问题讨论】: