Kev 69 Posted December 19, 2011 Report Share Posted December 19, 2011 Hi all, I am using 4.0 Pro and want to know how this would work for phone numbers I would like to remove the first zero from a phone number and replace it with a country code, for example 0443 123 3322 I would want to drop the first 0 and replace it with 61 leaving me with 61443 123 3322 I have the phone number currently inside a variable, called #phone and call upon that variable further on in my bot, so ideally would like to keep the variable name and update the variable value. Thanks in advance! Quote Link to post Share on other sites
JohnB 255 Posted December 19, 2011 Report Share Posted December 19, 2011 You can do this using the replace command. For the purpose of this explanation I will explain how to do it in two commands (although ultimately you can do it with one, it's just easier to see in two). set--->#phone(0443 123 3322)set--->#phone--->$replace(#phone, 044, 6144)Does that make sense? If not I'll provide the actual code.John Quote Link to post Share on other sites
Kev 69 Posted December 22, 2011 Author Report Share Posted December 22, 2011 Hi John, Just getting back to this now Here's what I have http://content.screencast.com/users/koconnor00/folders/Jing/media/a99f9234-7f8c-4671-ac26-4094ba16ab30/2011-12-22_0928.png Is this what you meant? Also, I would be concerned should the numbers 07 appear further in the phone number as this could cause a problem with replacing them. Quote Link to post Share on other sites
Kev 69 Posted December 22, 2011 Author Report Share Posted December 22, 2011 Ok just to update - this replace works well, exactly as I had hoped. Only the issue is if the number 07 appeared more than once in the phone number. So ideally I only want it to replace the first 2 digits. I am assuming now some regex is in order. Any help on this would be great. Quote Link to post Share on other sites
Kev 69 Posted December 22, 2011 Author Report Share Posted December 22, 2011 Actually, it would be even easier for me if I simply replace the FIRST zero with 44 That would actually make this process easier and take into account landline numbers as well as mobile numbers. Quote Link to post Share on other sites
Kev 69 Posted December 22, 2011 Author Report Share Posted December 22, 2011 Still looking for help on this - I think it's regex I need to look at so any pointers on how to handle this would be greatly appreciated. Quote Link to post Share on other sites
Pete 121 Posted December 22, 2011 Report Share Posted December 22, 2011 set(#phone, "0443 123 3322", "Global")set(#phone, $replace regular expression(#phone, "\\b0", 61), "Global") Quote Link to post Share on other sites
Kev 69 Posted December 22, 2011 Author Report Share Posted December 22, 2011 Perfect, thanks Zap. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.