【发布时间】:2011-11-12 19:35:14
【问题描述】:
我需要在较长的字母数字数据字符串中识别子字符串“X.123”和/或“X.8”。例如:
A cow flew over the moon in the X.123 module, not the X.124.3 module,
and certainly not the X.125C78 module. The cow poo-pooed the X.8 module.
如何排除第二个和第三个实例?到目前为止,这是我想出的获得“X.123”部分的方法:
/[X][\.][0-9]{1,4}/
我不确定如何让表达式在任何非数字字符处停止(例如:X124C78)
帮助不胜感激!
【问题讨论】:
-
飞牛+1 ;)
标签: regex