Skip to content
WM KeyboardWM Keyboard
Accessibility

Phone number formats

The masks that tell the clipboard which number-shaped runs are actually phone numbers: mask characters, length bounds, the matching leeway, and the built-in tester.

WM KeyboardToolsClipboardPhone number formats

The clipboard’s entity chips pull one-time codes, links and phone numbers out of what you copy. A code has a shape and a link has a scheme, but a phone number is just digits, so with nothing to go on the detector keeps every run of 7 to 15 of them. That’s how an invoice total, an order reference or a column out of a spreadsheet ends up wearing a phone chip. This screen is where you tell it what your numbers look like, and it stops guessing.

It only appears while Detect codes, numbers and links is on, since there would be nothing to filter otherwise.

Screenshot pending
Phone number formats: the explanation, Add a format, the saved masks, and the Test a number field.

Add a format opens a one-field dialog that takes either of two things, and works out which you gave it:

  • A number you copy often. It turns that into a mask for you: if you wrote a leading +, the dial code stays as it is and every other digit becomes an X. Your spaces and hyphens are kept, so +880 1712-345678 comes back as +880 XXXX-XXXXXX.
  • A mask you wrote yourself. Anything containing an X, an x or a # is read this way. x and # are stored as X so two spellings of one mask can’t both sit in the list.

The dialog previews the mask as you type (“Format: +880 XXXX-XXXXXX”), says “This is not a phone number yet” while the field holds something it can’t read, and keeps Add disabled until it can.

The mask it makes from an example is a starting point, not the finished thing. Type a digit back over one of the Xs to pin it: that’s how +880 XXXX-XXXXXX becomes +880 1XXX-XXXXXX, which says “dial code 880, then ten digits, and the first of those is a 1”.

CharacterMeaning
09A digit that has to match exactly at that position
XAny digit (x and # are accepted and stored as X)
+ at the frontWhat follows is a dial code, so this mask names a country
space - ( ) . [ ] /Decoration. Ignored on both sides, so write the mask the way you write the number

Anything else, a letter or a currency sign, means it isn’t a mask and won’t save.

Two bounds apply to the digits, wildcards included: at least 4, at most 15. Below four a mask stops naming a number and starts matching stray digits, and fifteen is the ceiling E.164 puts on a phone number anywhere in the world.

For a mask with a +, the dial code is whatever comes before the first separator you wrote: +880 1XXX-XXXXXX has a dial code of 880 because of the space. Write it without separators and the length is worked out instead, from the same three rules E.164 uses. One digit for the zones starting 1 or 7 (North America, Russia and Kazakhstan). Two digits for the 44 codes that get two: 20, 27, 30 to 34, 36, 39, 40, 41, 43 to 49, 51 to 58, 60 to 66, 81, 82, 84, 86, 90 to 95, and 98. Three for everywhere else.

A mask that is nothing but a dial code won’t save either: there’d be no number left to match.

A dial code written as wildcards names no country, so a mask like +XX 1XXX-XXXXXX can’t hold you to one. Rather than reject it, the mask keeps the part that still means something: the wildcards where the code was are dropped and what’s left becomes a national mask. It behaves exactly as though you’d written 1XXX-XXXXXX, which is a real filter (ten digits starting with a 1, from any country) and not the one you might have thought you were writing. The row still reads back the way you typed it, + and all, so the plus sign in it is doing nothing.

The matching is forgiving about the things people vary and strict about the things they don’t.

Forgiving:

  • Separators are ignored on both sides. 01712-345678, 01712 345678 and (01712) 345678 are all the same number to a mask, whatever the mask itself was written with.
  • The country code is optional. A mask with a dial code also matches the number without it, and with a national trunk 0 in the dial code’s place. One mask covers +8801712345678, 8801712345678, 01712345678 and 1712345678.
  • The trunk 0 goes on whichever side lacks it, never both, so a mask of nine wildcards can’t quietly start accepting ten digits.

Strict:

  • The length has to be exact. A mask is a template, and a run of digits either fills it or doesn’t.
  • A pinned digit has to be there. 1XXX-XXXXXX turns down anything whose national part starts with a 2.
  • A clip that names a country has to match one. A leading + or 00 is a statement about where the number is from, so it’s checked against the mask’s dial code. That’s what keeps a foreign number out. Against a national mask, the clip’s own dial code is stripped off first and only the rest is compared, since a national mask has nothing to say about countries.

Test a number at the bottom takes a number and tells you the answer straight away, before you find out the hard way with a clip you needed:

  • “The keyboard makes a chip for this number.”
  • “The keyboard skips this number. It matches no format.” (shown in the error colour)
  • “There is no format, so the keyboard makes a chip for this number.” while your list is empty.

Nothing you type here is saved or matched against anything but your own masks.

With no formats saved, the detector falls back to shape alone: 7 to 15 digits, and no more than 11 of them if the run has no punctuation and no +. Save even one format and those stand-ins step aside, because you’ve told it something better: the floor drops to 4 digits and your masks decide the length.

Everything else stays exactly as it was. A mask can only take numbers away, never add one back, so a run still has to be found as a number first, and the guards around that don’t move: a bare year or date is never a phone number, and neither is a run of digits sitting right after #, $, £ or .

ControlWhat it doesDefault
Add a formatOpens the dialog described aboveNothing saved
The saved listOne row per mask, sorted alphabetically, each with a delete iconEmpty
Test a numberText field, checks a number against your masks without saving itEmpty

The list has no cap: add one per country you deal with. It’s a set rather than a list, so adding a mask you already have changes nothing.

  • Delete has no confirmation. The trash icon on a row removes that mask on the tap, with no prompt and no undo. Deleting your last one puts you back to catching every number.
  • This screen is a filter, not a switch. Turning Detect codes, numbers and links off hides it and stops all the chips, formats or no formats.
  • Masks are settings, so they travel. They’re stored with the rest of your preferences and ride along in a settings export, not in the clipboard section of a backup (that section carries clips).
  • Written formats keep your separators, examples keep the example’s. The mask is stored as typed apart from the x/# folding, so +880 1XXX-XXXXXX and +8801XXXXXXXXX both sit in the list looking like what you gave it, and match identically.
  • The dial-code rules are rules, not a table of countries. They cover every dial code in three lines instead of two hundred rows, which is why a mask you wrote without separators is split where E.164 says rather than where a particular country’s list says.
  • No edition differences. The screen and the matching behave the same on the full and lite builds.
  • Clipboard manager: the entity chips these masks filter, and every other clipboard setting.
  • One-time codes: the other fragment the clipboard pulls out on its own, which needs no configuring.
  • Tools: the master tool list this screen hangs off, two levels up.