Skip to content

Instantly share code, notes, and snippets.

@sakatam
Created October 5, 2012 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakatam/3837932 to your computer and use it in GitHub Desktop.
Save sakatam/3837932 to your computer and use it in GitHub Desktop.
a better (and not too explicit) set of regular expressions for japanese phone numbers
// a better (and not too explicit) set of regular expressions for japanese phone numbers based on a spec defined by ministry of internal affairs (総務省).
// http://www.soumu.go.jp/main_sosiki/joho_tsusin/top/tel_number/q_and_a-2001aug.html
// fixed phones
/^0(\d{1}-?\d{4}|\d{2}-?\d{3}|\d{3}-?\d{2}|\d{4}-?\d{1})-?\d{4}$/
// mobile / PHS
/^0[789]0-?\d{4}-?\d{4}$/
// IP phones
/^050-?\d{4}-?\d{4}$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment