Answers for "regular expression num from string"

VBA
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

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 "regular expression num from string"

Code answers related to "VBA"

Browse Popular Code Answers by Language