Regex to find phone numbers in text
Posted: Mon Jul 26, 2021 2:39 am
Using Regex from this thread: https://stackoverflow.com/questions/166 ... one-number
I am trying to use matchtext to identify phone numbers in text.
Can someone tell me why the following doesn't work:
Passing in phone number text eg. something like
More generally what do people recommend for testing and developing regex statements to try to find out why they are not working?
I am trying to use matchtext to identify phone numbers in text.
Can someone tell me why the following doesn't work:
Passing in phone number text eg. something like
Code: Select all
some text and phone number(s) such as
123-456-7890
(123) 456-7890
123 456 7890
123.456.7890
+91 (123) 456-7890
Code: Select all
private command tpDetectPhoneNumber pt,@pDataA
local tPhone
get matchText(pt,"(^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$)",tPhone)
answer it && tPhone