SafePhone logoSafePhone

How to Block Calls by Prefix, Ending Digits or Number Pattern on Android

Do you keep getting marketing and telemarketing calls from numbers starting with the same area code, each time from a different number? Instead of blocking numbers one by one, you can block calls by prefix, by ending digits, or block a whole group of numbers that follow a pattern with a single rule. This guide explains the syntax and how to set it up on an Android phone with SafePhone.

Block calls by prefix or ending digits with SafePhone

Get SafePhone on Google Play

When should you block calls by prefix?

Blocking with a blacklist or accepting calls only from your contacts are both useful, but each has its limits:

In practice, many nuisance calls come from the same number range: telemarketing call centers use batches of landline numbers with the same prefix, for example, or numbers of unusual length. Blocking by number pattern lets you:

Prefix blocking works alongside automatic blocking of unknown and scam numbers; we recommend turning on both.

Rule syntax for blocking prefixes and ending digits

In SafePhone, each * stands for any single digit (0–9). A rule must have exactly as many characters as the phone number you want to block. Number length depends on your country's numbering format (mobile and landline numbers may also differ), so check how many digits the numbers you want to block have, for example by looking at them in your call log. The examples below use 10- and 11-digit numbers.

To blockRuleExample of a blocked number
10-digit numbers starting with 555555*******555 123 4567
11-digit numbers starting with 01230123*******0123 456 7890
10-digit numbers starting with 09000900******0900 123 456
10-digit numbers ending in 888*******888555 234 5888
10-digit numbers following a custom pattern55*5****8*552 512 3481
Any 12-digit number************Numbers of unusual length

A rule with fewer or more characters than the actual number won't match, so count your * characters carefully.

How to set up prefix blocking in SafePhone

  1. Open the SafePhone app. If you haven't installed it yet, get SafePhone on Google Play.
  2. Switch to the third tab.
  3. Tap “Block by prefix”.
  4. Add a new rule using the syntax above, for example 555******* to block every 10-digit number starting with 555.
  5. Tap “Save”.
  6. Make sure you've granted SafePhone the call screening permission. If not, follow the steps in how to block unknown and scam numbers.

Once set up, SafePhone automatically filters incoming calls according to your rules: calls that match a rule are blocked before your phone rings.

Tips to avoid blocking important calls by mistake

For older parents or children, a safer option is to block calls from numbers not in your contacts: only people they know can get through, with no need to guess prefixes.

Conclusion

Prefix blocking is the fastest way to stop marketing and telemarketing calls coming from the same number range. Combined with a blacklist of scam numbers, you block both numbers that have already been reported and whole groups of newly appearing nuisance numbers.

Create your first prefix-blocking rule

Get SafePhone on Google Play

FAQ

What does * mean in a prefix-blocking rule?

Each * stands for exactly one digit from 0 to 9. For example, the rule 555******* (3 digits followed by 7 asterisks) blocks every 10-digit number starting with 555.

Can blocking a whole area code block important calls by mistake?

It can. The rule blocks every number that matches the pattern, including banks, hospitals and businesses with numbers in that range. Check your blocked call log and temporarily turn the rule off when you're expecting an important call.

Does prefix blocking require the call screening permission?

Yes. SafePhone needs Android's call screening permission to check incoming numbers before they ring. Without it, prefix-blocking rules won't work.

Should I block by prefix or block numbers not in my contacts?

Blocking by prefix works well when you only want to get rid of one group of nuisance numbers while still receiving calls from other unknown numbers. Blocking numbers not in your contacts suits older parents and children, who only need calls from people they know.