EDA365电子论坛网
标题:
【以解决】请问怎么匹配 "2.3001 MM",并且提取2.3001和MM
[打印本页]
作者:
361553894
时间:
2016-10-24 10:36
标题:
【以解决】请问怎么匹配 "2.3001 MM",并且提取2.3001和MM
本帖最后由 361553894 于 2016-10-25 12:08 编辑
rexMatchp("^[0-9]*[.][0-9]+ [a-zA-Z]*$" "2.3001 MM")是能匹配的
现在想用rexCompile、rexExecute匹配,rexSubstitute提取,即
rexCompile("\\([0-9]*[.][0-9]+\\) \\([a-zA-Z]*\\)")
when(rexExecute("2.3001 MM")
height_max_value = rexSubstitute(“\\1”)
height_max_unit = rexSubstitute(“\\2”)
)
复制代码
但是匹配不上
丢代码上来好困难啊。。总是因为转义字符变了(上面引号改成中文引号了)
作者:
hoo
时间:
2016-10-24 14:07
Skill > rexCompile("\\([0-9.]+\\) \\([a-zA-Z]+\\)")
t
Skill > rexExecute("2.3001 MM")
t
Skill > height_max_value = rexSubstitute("\\1")
"2.3001"
Skill > height_max_unit = rexSubstitute("\\2")
"MM"
复制代码
作者:
361553894
时间:
2016-10-25 12:08
hoo 发表于 2016-10-24 14:07
非常感谢
作者:
wcjcn
时间:
2017-6-9 10:27
非常感谢。。。。。
欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/)
Powered by Discuz! X3.2