【发布时间】:2016-10-07 09:21:30
【问题描述】:
我有一个带有类似数学公式的字符串
5+10/3-3.0 *(4+8.0)
我想将所有 int 值替换为 double
结果:
5.0+10.0/3.0-3.0 *(4.0+8.0)
我可以使用 ([\d]*)\.([\d]*) 找到双精度值,但我想找到所有不属于双精度值的 ([\d]*)
【问题讨论】:
-
我可能有一些东西,但它只能与回调函数结合使用,这使得它依赖于语言。你用它做什么?
-
请注意,如果 OP 将
5-10/3-3.0 *(4+8.0)作为输入,来自Regular Expression for whole numbers and integers?的正则表达式将无济于事。 -
Questions may be duplicates if they have the same (potential) answers... If it's only a matter of changing some numerical values or some variable names, they're duplicates.。我想提请您注意不要回答已经在其他地方回答过的问题。是的,你可能会获得几分声誉,但是,因为你在复制内容,你实际上让互联网变得更糟。这是删除
-的问题吗?这是重复的! @WiktorStribiżew
标签: regex