Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
find phone number in string
#5
Hi Nate,

your needs is far more complicated as you need many phone numbers formatted
in differents ways.

You can just adapt the code to mtch all patterns.

findrx(s "(\d{3}-\d{3}-\d{4})" 0 4 t)

try:

800-123-1234 (\d{3}-\d{3}-\d{4})
(800)123-1234 (\(\d{3}\)\d{3}-\d{4})
800.123.1234 (\d{3}\.\d{3}\.\d{4})
800 123 1234 (\d{3} \d{3} \d{4})


maybe a general one can be found, something like
(\d{3}).*(\d{3}).*(\d{4})

all is non tested, but you get the picture..

HTH


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)