2024-05-20 21:00:46 发布
网友
有一个字符串I bought a beautiful gift for my friend. It cost me US$ 1,500.25. My friend was very happy. But then she asked for a US$1,700 gift
I bought a beautiful gift for my friend. It cost me US$ 1,500.25. My friend was very happy. But then she asked for a US$1,700 gift
我想得到关键字gift后面的第一个双数1,500.25。你知道吗
gift
1,500.25
如何用正则表达式实现这一点。你知道吗
非常感谢。你知道吗
你可以用这个正则表达式-
gift.*?(\d+(?:,\d+)*(?:\.\d+)?)
它适用于问题中的例子。正则表达式解释可以找到here
正则表达式部分是:
gift.*?\d+(?:,\d+)*(?:\.\d+?)
Useful link创建正则表达式。 Tutorial表示正则表达式。你知道吗
你可以用这个正则表达式-
它适用于问题中的例子。正则表达式解释可以找到here
正则表达式部分是:
Useful link创建正则表达式。 Tutorial表示正则表达式。你知道吗
相关问题 更多 >
编程相关推荐