I need assistance with extracting phone numbers from a text string that may be empty or formatted in multiple ways. Here are a few variations I might encounter:
- “Call: 04 27 52 12 87 Mobile: 07 67 11 06 87”
- “Call: 04 27 52 12 87”
- “Mobile: 07 67 11 06 87”
Additionally, another format could be used: (0039) 234786. The markers to look for are “Call:” and/or “Mobile:”. I’m storing these numbers in two separate variables, one for mobile and another for landline.
So far, I have experimented with split and indexOf methods but I suspect there’s a more effective approach. Could anyone provide some insights or recommendations?