Regular expression for validating numbers only
Your use of Stack Overflow’s Products and Services, including the Stack Overflow Network, is subject to these policies and terms.To allow numbers with an optional decimal point followed by digits.
If you enter a number then a space it works, but if you just input a space, it does not work. You're right on time again Sonu Kapoor, thanks again! It's very hard to find the right answer on this site, as only a handful of posters actually post the correct answer with no missing (essential) information.
You need TWO validator controls to ensure only numeric values are entered.
As written, re Snippet is designed to be dropped into other regular expressions, so you can extract (or avoid) numbers. ' // Optional exponent 0-29 for scientific notation.
Despite all the parentheses, it contains no capturing groups.