excel

Docs › Rules

Korean validators (kr.*) for Korean business data

Column types for Korean business data: business, corporate and resident registration numbers, Korean phone numbers, postal codes and won amounts. Rules tuned not to reject real numbers.

These column types are for Korean business data: the registration numbers, phone numbers, postal codes and won amounts that Korean companies collect in Excel uploads. Outside Korea you will not need them; the rest of 82excel works the same without them.

The rule they follow is never reject a real number. Where a check formula has no official source or changed (corporate numbers; resident numbers issued since October 2020), a mismatch is only a warning.

{
  "columns": [
    { "key": "brn",    "header": "사업자등록번호", "type": "kr.brn" },
    { "key": "crn",    "header": "법인등록번호",   "type": "kr.crn", "required": false, "crn": { "checksum": "warn" } },
    { "key": "rrn",    "header": "주민등록번호",   "type": "kr.rrn", "rrn": { "checksum": "warn" } },
    { "key": "phone",  "header": "휴대폰",        "type": "kr.phone", "phone": { "kind": "mobile" } },
    { "key": "zip",    "header": "우편번호",      "type": "kr.zip" },
    { "key": "amount", "header": "금액",          "type": "kr.amount", "min": 0 }
  ]
}
typeRuleCanonicalNote
kr.brn business registration number (사업자등록번호)10 digits (-, space or . separators allowed) with the check digit (weights 1,3,7,1,3,7,1,3,5)123-45-67890A valid check digit does not prove the business exists; confirm that on the server with the National Tax Service API
kr.crn corporate registration number (법인등록번호)13 digits, format only (default)110111-1234567The checksum has no official source, so it is off by default; crn.checksum: "warn" turns on a warning (CRN_CHECKSUM), never an error
kr.rrn resident / foreigner registration number (주민·외국인등록번호)13 digits; a real birth date in the century given by the 7th digit (0–9)YYMMDD-NNNNNNNA checksum mismatch is only the warning RRN_CHECKSUM: numbers issued since October 2020 end in random digits, so the old formula no longer holds. Future birth dates are accepted when the format is right
kr.phone Korean phone numberMobile 010+4+4 (4-digit middle only), 011/016/017/018/019+3–4+4; area codes 02, 031–033, 041–044, 051–055, 061–064+3–4+4, 070+4+4, 0502–0508; representative numbers 15xx/16xx/18xx+4 (kind any only)010-1234-5678, 02-123-4567, 1588-1234+82 / 82 become 0. Digits that would be right with a leading 0 (1012345678) give LEADING_ZERO_LOSS, with a hint to set the cell format to Text
kr.zip Korean postal code5 digits (since August 2015)01234 (5-digit string)Old 6-digit codes (123-456) get their own message; 4 digits give LEADING_ZERO_LOSS
kr.amount won amount12,000, 12000원, ₩12,000, KRW 12000, (1,000) / △1,000 / ▲1,000 / -1,000 (negative), +1000JS number1천원, a lone - and two signs are rejected; values beyond ±2^53−1 too

Lost leading zeros

When Excel stores a Korean phone number or postal code as a number, its leading zero is lost (01012345678 → 1012345678). kr.phone, kr.zip and kr.rrn report values that would be right with the zero as LEADING_ZERO_LOSS, with a hint to set the cell format to Text; the severity is the column's. When the file is read, number cells in text-like columns get the same code as a warning.

Masking personal data

Values of kr.rrn and kr.phone columns are always masked in messages, reports and previews (900101-1******, 010-****-5678). The result.rows you upload are not masked. See the personal data section of Rules format.

Functions only

The validators are also exported from 82excel/kr (Excel82.kr in the CDN build): isBrn(s), isCrn(s), isRrn(s) (format and birth date only, checksum ignored), isPhone(s, kind?), isZip(s), isAmount(s), and normalizeKrBrn and friends, which return the cleaned value and a code.

import { isBrn, isPhone, isZip, isAmount } from '82excel/kr';   // CDN: Excel82.kr

isBrn('123-45-67891');               // true  (digits and check digit)
isBrn('123-45-67890');               // false (wrong check digit)
isPhone('010 1234 5678', 'mobile');  // true
isZip('01234');                      // true
isAmount('₩12,000');                 // true