Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
find phone number in string
#6
Macro Macro2119
Code:
Copy      Help
out
ARRAY(str) testNumbers; int i
testNumbers[]="phone: 800-123-1234x12345[]new line with other text"
testNumbers[]="myphone: (800)123-1234 x12"
testNumbers[]="your phone number: 800.123.1234"
testNumbers[]="your phone number: 800 123 1234"

str s
for i 0 testNumbers.len
,if(testNumbers[i].replacerx("(?s)\D*(\d)\D*(\d)\D*(\d)\D*(\d)\D*(\d)\D*(\d)\D*(\d)\D*(\d)\D*(\d)\D*(\d).*" "$1$2$3$4$5$6$7$8$9$10" 4)<0) out "invalid"; continue
,out testNumbers[i]


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)