Format patterns for developers and QA

ICCID Regex for Format Validation

Copy a strict current-format pattern, test one field, and keep regex, normalization, the 89 telecom identifier, and the Luhn check as separate results.

Regex lab / 01

Test one ICCID field

The strict pattern is anchored: the raw field must contain exactly 19 ASCII digits, begin with 89, and contain nothing else.

Try a valid number, an incorrect final digit, a spaced value, a 20-digit ETSI LI field example, or EF_ICCID text with a trailing F.

The regex and Luhn modules test this value in the browser and do not send it to this site's ICCID processing server. The page still loads site files and Google services; see the exact privacy boundary.

Regex is only the first gate

A format match will be reported separately from separator normalization, Luhn mathematics, and current ICCID structural validity.

Patterns / 02

Choose the ICCID regex for the actual job.

Current-number validation, text extraction, and source-specific data exchange are different tasks. One permissive expression should not silently stand in for all three.

Strict current field19 digits + 89 MII
^89[0-9]{17}$

Use for a normalized field in this site's current E.118 workflow. It checks ASCII digits, total length, and the telecom prefix. It does not calculate Luhn.

Common-engine extractionCapture group 1
(?:^|[^0-9])(89[0-9]{17})(?![0-9])

Use capture group 1 in JavaScript, Python, Java, and PCRE-style engines when scanning logs without lookbehind. Confirm syntax in any other regex dialect. The numeric boundaries prevent a false partial match inside a longer digit run.

Lookbehind extractionModern engines
(?<![0-9])89[0-9]{17}(?![0-9])

This form returns only the ICCID-shaped substring, but older or restricted engines may not support lookbehind. Keep the portable capture pattern as a fallback.

ETSI LI fieldSource-specific shape only
^[0-9]{19,20}$

ETSI TS 103 280's Lawful Interception common-parameter dictionary specifies [0-9]{19,20} for its ICCID field. The anchored form above adapts that pattern for whole-string matching; it does not require 89, verify Luhn, or define a universal ICCID interface.

Regex boundary: use [0-9] when you specifically require ASCII decimal digits. The meaning of \d varies by regex engine and may include Unicode digits.

Implementation / 03

ICCID format regex in JavaScript, Python, Java, and HTML.

These examples intentionally perform format-only checks. Follow a format match with a separate Luhn function or the site's transparent calculator.

JavaScriptRegExp.test
const ICCID_FORMAT = /^89[0-9]{17}$/;

function hasIccidFormat(value) {
  return ICCID_FORMAT.test(value);
}
Pythonre.fullmatch
import re

def has_iccid_format(value: str) -> bool:
    return re.fullmatch(r"89[0-9]{17}", value) is not None
JavaString.matches
static boolean hasIccidFormat(String value) {
    return value != null
        && value.matches("^89[0-9]{17}$");
}
HTMLpattern attribute
<input
  inputmode="numeric"
  maxlength="19"
  required
  pattern="89[0-9]{17}">
Do not hide checksum logic inside an unreadable mega-regex

Use regex for lexical shape and normal code for Luhn. The ICCID Luhn calculator publishes tested JavaScript and Python implementations plus a digit-by-digit trace.

Test vectors / 04

Reproducible valid and invalid ICCID regex cases.

These fixed fixtures exercise format, prefix, length, normalization, non-decimal input, and Luhn behavior without depending on random output.

Case Input Raw strict Normalized strict ETSI LI field Luhn Current structure
Valid current8910112345678901238MatchMatchMatchPassValid structure
Second synthetic valid8944123456789012348MatchMatchMatchPassValid structure
Wrong check digit8910112345678901234MatchMatchMatchFail, expect 8Invalid
Wrong industry identifier9910112345678901237No matchNo matchMatchPassInvalid
Missing check digit891011234567890123No matchNo matchNo match—Invalid
20-digit ETSI LI field shape89101123456789012380No matchNo matchMatch—Invalid in strict mode
Supported separators8910 1123-4567 8901 238No matchMatchAfter normalizationPassValid after normalization
Trailing F8910112345678901238FNo matchNo matchNo match—Invalid decimal field
Embedded letter89101123456789012A8No matchNo matchNo match—Invalid decimal field
Outer whitespace␠8910112345678901238␠No matchMatchAfter normalizationPassValid after trimming

Dataset boundary: the values are synthetic structural fixtures, not carrier records. They were not obtained from a subscriber database and are not claimed to be unassigned; never use them as production identities or activation credentials.

Standards / 05

Why ICCID regex examples disagree about 19 or 20 digits.

The answer depends on whether a developer is validating the current E.118 PAN or implementing the specific field contract of another standard or system.

Current strict product rule

This site treats the current E.118 ICCID PAN as 19 decimal digits, beginning with the 89 telecommunications MII, with a final Luhn check digit.

ETSI LI field compatibility

ETSI TS 103 280 defines a 19- or 20-decimal-digit ICCID parameter in its Lawful Interception common-parameter dictionary. That source-specific lexical allowance is not a universal interface rule and does not add a current E.118 validity guarantee.

EF_ICCID BCD filler

A trailing hexadecimal F can appear when EF_ICCID BCD storage is rendered as text. It is not accepted by the ETSI LI decimal field pattern and is not a twentieth Luhn digit; inspect it with the ICCID and EF_ICCID decoder.

Primary sources

Keep numbering conformance and LI dictionary syntax distinct.

ITU-T E.118 is the numbering source for the ICCID PAN. ETSI TS 103 280 is a Lawful Interception common-parameter dictionary and points its ICCID field to ETSI TS 102 221. This page labels that second pattern by its narrower purpose.

FAQ / 06

ICCID regex questions

Practical answers about anchors, ASCII digits, Luhn, extraction boundaries, the 20-digit ETSI LI field shape, and activation claims.

What is the strict ICCID validation regex?

For this site's current normalized 19-digit workflow, use ^89[0-9]{17}$. It requires the telecommunications prefix and exact length, but it remains a format-only check.

Can regex validate the ICCID Luhn digit?

Not usefully. Regex is appropriate for characters, prefix, and length. Calculate Luhn in ordinary code so the rule remains readable, testable, and able to report the expected final digit.

Why use [0-9] instead of \d?

[0-9] explicitly means ASCII decimal digits. Some regex engines interpret \d as a broader Unicode digit category, which can accept characters that a telecom data field does not expect.

Should an ICCID regex accept 20 digits?

Only when the consuming contract explicitly documents that shape. ETSI TS 103 280 uses it for a Lawful Interception common parameter; that does not make it universal. Keep it separate from current strict E.118 validation, and do not label every 20-digit match as conformant or issued.

Does a regex and Luhn pass prove a SIM is active?

No. Those checks do not query an issuer or carrier. They cannot prove that a SIM or eSIM profile exists, is assigned, belongs to an account, is active, or can access a network.