Skip to content

Vehicle plates

DERegion code
11 regencies and cities in Maluku
4502Number
BSuffix letters

Well-formed

A plate has a region code of one or two letters, a number of up to four digits, and a suffix of up to three letters: B 1234 XYZ. Region codes are checked against Perpol 7/2021 plus the 2024 codes for the new Papua provinces (PY, PS, PT, PG). RI is also accepted.

Go TypeScript Returns
plate.Valid(s) plate.isValid(s) Whether s is a well-formed plate
plate.Parse(s) plate.parse(s) region, number, suffix
plate.Format(s) plate.format(s) Upper case, single spaces: B 1234 XYZ

Input is case-insensitive. Accepted separators: space and -. Groups may also be written without separators (b1234xyz).

Use region.ByPlate to list the regencies registered under a region code.

length, charset, format (groups in the wrong order or too long), region (unknown region code).

Diplomatic plates (CD 12 5) are not supported yet.

package main
import (
"errors"
"fmt"
"github.com/haikalmumtaz233/nusaindex/plate"
)
func main() {
fmt.Println(plate.Valid("DR 2826 IBN"))
parsed, err := plate.Parse("dr2826ibn")
if err == nil {
fmt.Println(parsed.Region, parsed.Number, parsed.Suffix)
}
formatted, err := plate.Format("b-1234-xyz")
if err == nil {
fmt.Println(formatted)
}
_, err = plate.Parse("QQ 1234 AB")
fmt.Println(errors.Is(err, plate.ErrRegion))
}
Output
true
DR 2826 IBN
B 1234 XYZ
true