validateRg function performs basic structural validation of an RG number. It removes non-alphanumeric characters, checks if the length is between 7 and 9 digits, and optionally allows a final letter (check digit).ts
import { validateRg } from "@arkyn/shared";
string): The RG string, which may be formatted.boolean): Returns true if the RG format is considered valid, otherwise, false.ts
import { validateRg } from "./validateRg";validateRg("12,345,678-9"); // truevalidateRg("MG-12,345,678"); // false (format not supported)validateRg("12345678X"); // true