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.
Functions
Section titled “Functions”| 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.
Errors
Section titled “Errors”length, charset, format (groups in the wrong order or too long), region (unknown region code).
Diplomatic plates (CD 12 5) are not supported yet.
Example
Section titled “Example”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))}import * as plate from "nusaindex/plate";
console.log(plate.isValid("DR 2826 IBN"));
const parsed = plate.parse("dr2826ibn");if (parsed.ok) { console.log(parsed.value.region, parsed.value.number, parsed.value.suffix);}
const formatted = plate.format("b-1234-xyz");if (formatted.ok) { console.log(formatted.value);}
const unknown = plate.parse("QQ 1234 AB");console.log(!unknown.ok && unknown.error.code === "region");trueDR 2826 IBNB 1234 XYZtrue© 2026 Haikal Mumtaz