piighost/br-rg

Brazilian national identity card number, the RG, in the two layouts Purview documents: the old Registro Geral as two digits, a period, three digits, a period, three digits, a hyphen and one check digit, and the newer Registro de Identidade as ten digits, a hyphen and one check digit. The separators are required, a bare run of digits is not matched. Purview describes the check character as a digit, so RG numbers whose check character is the letter X, common in some states, are not matched here. Reproduced collision: the dotted form is matched whole by PL_PHONE, which accepts periods and hyphens between its nine digits; BR_CPF is not touched, since it groups three, three, three and two.

Label: BR_RG

Pattern

(?<!\w)(?:\d{2}\.\d{3}\.\d{3}-\d|\d{10}-\d)(?!\w)

Must be caught

Must be left alone

Tags: br, government-id, identity

Download the detector as TOML