I need regular expression for numbers that can be negative, with commas or decimal.
For examples: 12 +12 -12.0 -12,345.5466 +12,345,678,678 0.154
But not pass: "500." or "500,". I want that 500 will return as a number without the point or the comma that connect to the number.
The regular expression that I wrote is:
[-+]?((0|([1-9](\d*|\d{0,2}(,\d{3})*)))(\.\d*[0-9])?)(?!\S)
It is work at the correct numbers (like the examples), but It don't work for the '500,' or '500.'