Hello, I’m giving an example. A phone number starts with +90. How can I get this data in 2 separate ways. + and 90 will be separate.
I Need to Separate + from Phone Number
Hello, I’m giving an example. A phone number starts with +90. How can I get this data in 2 separate ways. + and 90 will be separate.
I Need to Separate + from Phone Number
There are lots of ways to do this using string manipulation but probably the best is using a text parser and regular expression parser especially since there are many conditions such as
If we assume a properly formatted international phone number this regex will work. The first two capture groups will extract the + and code and the last capture group will extract the phone number
(\+?)(\d{1,4}?[-.\s]?\(?\d{1,3}?\)?)[-.\s]?(\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9})
Thanks, Alex. It worked.