Skip to content

Add a toll-free number preset - regex is overkill for this common case #673

Description

@tmastran

The feature

90% of my spam comes from Toll Free Numbers.

Blocking toll-free numbers (800/888/877/866/855/844/833) currently means writing a custom regex. Getting it right isn't trivial. You need to handle the country code being stripped inconsistently (leading +, 0, or 1), or you end up either missing numbers or accidentally matching unrelated ones. It took me a few rounds of testing to write something that worked cleanly.

Since you already have presets for cases like the private/hidden numbers, maybe toll-free could get the same treatment? A simple toll-free preset instead of asking users to try and write this correctly:

[01]?(800|888|877|866|855|844|833)\d{7}

I'd target this to NANP (US/Canada) at first, since other countries use different toll-free prefixes/lengths (UK, Germany, etc. all differ), so that's really a separate feature.
This seems like it would be a quick win for a lot of users.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions