Forms

Accept pasted labels and notes

normalize
Take the main number from lines like
Try it
  • 03-5253-8111
  • 03-5253-8111
  • 092-513-5612
  • 03-5253-8112

How it works

People paste numbers with their surroundings. normalize removes what commonly comes with a single number:

  • a leading label: TEL:, FAX:, 電話:, 電話番号:, in half or full width;
  • a trailing note: (代表), (代), (直通), or an extension written with 内線.

The result holds the main number only; the extension is not kept. Anything else around the number makes the input invalid. To find numbers in free text, use extract.

In each language

import { normalize } from "@kurashina-design/japan-phone";

// Lines copied from web pages and email signatures.
const pasted = [
  "TEL:03-5253-8111(代表)",
  "電話番号:03-5253-8111(内線21‐214)",
  "Tel: (092(513)5612) (直通)",
];
for (const line of pasted) console.log(normalize(line)?.national);

Output:

03-5253-8111
03-5253-8111
092-513-5612