如何让空间和一个正则表达式在数字格式吗? - How to allow spaces in a number format with a regular expression?

- 此内容更新于:2015-12-20
主题:

:我有一个正则表达式匹配,就像我需要这种为以下工作:喜欢,或者23。09年或或…等。

原文:

I have a regular expression:

(?:\d*\.)?\d+. (?:\d*\.)?\d+

which matches for [any_number].[one_space][any_number] like 23. 09

I need this kind of regex to work for the following:

[any_number][zero_or_more_spaces].[zero_or_more_spaces][any_number] like - 23 .09 or 23. 09 or 23.09 or 23 . 09 or 23 .09 ..etc.

网友:

(原文:\d+\s*\.\s*\d+)

网友:你的条件是多余的,就足以让一个条件:

(原文:Your conditions are redundant, one condition is enough for all:[any_number][zero_or_more_spaces].[zero_or_more_spaces][any_number])

楼主:是的@Identity1。编辑,谢谢。

(原文:Yes @Identity1. Edited Thanks.)

解决方案:
试试这个正则表达式:描述演示https://regex101.com/r/rQ4eD6/1
原文:

Try this regex:

\d+\s*\.\s*\d+

DESCRIPTION

Regular expression visualization

DEMO

https://regex101.com/r/rQ4eD6/1