regex for numbers only javascript code example
Example 1: get only numbers regex javascript
var numberPattern = /\d+/g;
'something102asdfkj1948948'.match( numberPattern )
Example 2: just number regex js
// https://regex101.com/r/qyq3PG/1
// or
/^[0-9]*$/
Example 3: number pattern js
/^[\+\-]?\d*\.?\d+(?:[Ee][\+\-]?\d+)?$/
/*
matched values:
-2.14e10
+14E-20
42.69
*/