我有这样一段文字:“我的兄弟喝了7杯咖啡,然后用A4纸打印了他的作业,然后在I-90高速公路上开车。”
我只想提取文本的数字(在本例中为7,4,90)。我如何使用coldfusion做到这一点?
我怀疑必须使用REMatch函数,但我不擅长使用正则表达式,感谢大家的帮助。
发布于 2011-08-02 19:47:08
只需使用rematch,这将返回匹配编号的数组。
<cfset str = "my brother drunk 7 cups of coffee and then printed his homework in A4 paper. He then drove down the I-90 highway">
<cfset arrSearch = rematch("[\d]+",str)>
<cfdump var="#arrSearch#">https://stackoverflow.com/questions/6911402
复制相似问题