ID a caller regardless of custom number prefix and/or suffix Where I'm living right now people can call you with reverse charges by adding 99 prefix to the call.

The problem if that the received call ID appears with 99 as prefix and suffix, and unless you know their number you have no way of knowing who's calling.

Example:


  Let's say John's number is 5 123 4567 and he calls me with reverse charges. My phone caller ID will then display that 995123456799 is calling.


What I would like to do is to get the phone to both tell me it is a reverse charge call and who is the person calling.

Is there a way to do this other than creating an extra contact per person named "Reverse Contact"? (e.g. "Reverse John")
It's possible to accomplish it using automation apps. I have used Macrodroid.


In the Triggers tab, in "Call/SMS" section, select "Call Incoming", then "Select Contact(s)". Choose "{Any Contact]", "[Any Number]", "[Non Coontact]" and "Unknown Caller". Click OK.
In the Actions tab, in "Macrodroid Specific" section, click on "Set Variable", then "[New Variable]". Click OK. Enter the variable name, set its type to "String". Keep it local then click OK.
In the Actions tab, in "Macrodroid Specific" section, click on "Text Manipulation". then "Extract Text" followed by OK. For the "Source text", click the 3-dot and select "Call number", then click OK. For "Text to match (regex)", enter ^99(.+)99$. Choose "Group 1", then for "Save variable to", select the variable create during step 1. Click OK.
Save the macro and give it a name.
Edit the macro. Click the "+" on the Actions tab. In "Conditions/Loop" section, select "If clause". Click the "+" next to conditions, then in "Macrodroid Specific" section, select "Macrodroid variable". Select the variable created in step 1, choose "Contains". Enter \w+ and enable "Enable regular expression matching". Click OK.
In the Actions tab, in "Notification" section, click on "Display Dialog". Enter the dialog title. For the dialog text, press the 3-dot and select the variable created during step 1. Click OK.
On the Actions tab, click the up and down arrows and move the Display Dialog created in step 6 between the "If" and "End If".
Save the macro. It will look like the image below.


Explanation: When you receive a call, the number will be stored in the variable. it will then be checked if it starts and ends with 99 using the regular expression ^99(.+)99$. If yes, the number without the 99s ( the (.+) part of the regex) is extracted and displayed in a dialog box. If no, then no dialog is displayed.

See Regular Expression