Sep 4, 2002 #1 Esoteric ISP Joined Feb 10, 2001 Messages 93 Location US Is there a quick way to take this (555) 555-1212 and convert it to this 5555551212? Please help - I thought maybe a trim or Replace function might do this, without a function.
Is there a quick way to take this (555) 555-1212 and convert it to this 5555551212? Please help - I thought maybe a trim or Replace function might do this, without a function.
Sep 4, 2002 #2 onpnt Programmer Joined Dec 11, 2001 Messages 7,778 Location US Dim regEx Set regEx = New RegExp regEx.Global = true regEx.Pattern = "[\(\)\-\s]" str = "(333) 333-3333" str = Trim(regEx.Replace(str, "") alert str http://www.onpntwebdesigns.comadmin@onpntwebdesigns.com Upvote 0 Downvote
Dim regEx Set regEx = New RegExp regEx.Global = true regEx.Pattern = "[\(\)\-\s]" str = "(333) 333-3333" str = Trim(regEx.Replace(str, "") alert str http://www.onpntwebdesigns.comadmin@onpntwebdesigns.com
Sep 5, 2002 #3 sfvb Programmer Joined Nov 25, 2001 Messages 399 Location US This also works: str = "(555) 555-1212" str = replace(replace(replace(replace(str,"-", ""," ", "","", "","(", "" Upvote 0 Downvote
This also works: str = "(555) 555-1212" str = replace(replace(replace(replace(str,"-", ""," ", "","", "","(", ""
Sep 5, 2002 #4 onpnt Programmer Joined Dec 11, 2001 Messages 7,778 Location US I think the point of regex is to eleviate lines of code like that. (makes debugging hell!) however it does work well. http://www.onpntwebdesigns.comadmin@onpntwebdesigns.com Upvote 0 Downvote
I think the point of regex is to eleviate lines of code like that. (makes debugging hell!) however it does work well. http://www.onpntwebdesigns.comadmin@onpntwebdesigns.com
Sep 5, 2002 #5 sfvb Programmer Joined Nov 25, 2001 Messages 399 Location US (makes debugging hell!) I agree, but he seemed to want to use either the trim or replace function. Upvote 0 Downvote