Regex for integer and decimal number matching in JavaScript
This pattern matches optionally-signed integers and decimals. Anchor it or add thousands separators with the live tester to fit your needs.
/-?\d+(?:\.\d+)?/gTry it live
The pattern and sample strings below are pre-loaded. Edit anything, or describe a variation in plain English and generate your own.
/-?\d+(?:\.\d+)?/gvalid ✓Tested live on the JavaScript engine. Other flavors are validated and flagged for differences, not executed.
No samples.