Phone: 123-456-7890

Share actions you've created here.
Post Reply
Jesse
Posts: 8
Joined: Wed Jul 27, 2011 8:52 pm

Phone: 123-456-7890

Post by Jesse » Thu Jul 26, 2012 2:24 am

Most places in north america need phone numbers formatted this way

Code: Select all

Set s_reTrimWS = New RegExp
s_reTrimWS.Pattern = "[^0-9]"
s_reTrimWS.Global  = True
 
Clipboard.Value = s_reTrimWS.Replace( Clipboard.Value, "" )

If(Len(Clipboard.Value) = 7) Then Clipboard.Value = "541" & Clipboard.Value

If(Len(Clipboard.Value) = 10) Then
  s_reTrimWS.Pattern = "(...)(...)(....)" 
  Clipboard.Value = s_reTrimWS.Replace( Clipboard.Value, "$1-$2-$3" )
End If

Post Reply