Answers for "regex to check numbers"

3

just number regex js

// https://regex101.com/r/qyq3PG/1
// or 
/^[0-9]*$/
Posted by: Guest on July-11-2020
0

regex numeric digits

' Needs reference "Microsoft VBScript Regular Expressions 5.5"
Dim rRegex As Object
Set rRegex = CreateObject("VBScript.RegExp")

rRegex.Pattern = "[0-9]{8,9}"   ' 8 or 9 numbers
MsgBox rRegex.test("12345678")  ' True

rRegex.Pattern = "[0-9]+"       ' Numeric of any size
MsgBox rRegex.test("12345")     ' True
Posted by: Guest on February-06-2021
0

number pattern js

/^[\+\-]?\d*\.?\d+(?:[Ee][\+\-]?\d+)?$/

/* 
	matched values:
    -2.14e10
    +14E-20
    42.69
*/
Posted by: Guest on June-29-2020
0

regex get number from string

const regex = /(12345)/gm;
const string = 'My id is 12345.';

console.log(string.replace(regex, '54321')) // My id is 54321.
Posted by: Guest on October-31-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language