【发布时间】:2014-08-08 01:45:03
【问题描述】:
我正在尝试进行 grep 搜索以匹配时间。例如我想匹配以下短语:
12 45 am in CA
It is currently 3 45 am
16 45 pm is the current time
3 23pm in a few hours
10 00 is the best time
我尝试使用:
grep '[0-12] [0-5][[0-9]]( ){0,1}(am|pm){0,1}'
现在我的输出没有意义。如果是的话,我应该逃避一些角色吗?为什么?
【问题讨论】:
-
10 00也是按时间匹配的吗? -
@user3218114 你能举一个期望输出的例子吗?对我来说,不清楚您是要获取完整的短语还是仅获取数字。
-
10 is the best time匹配吗?