CEC-5591: strip out special characters in vehicle search (#496)

This commit is contained in:
Tristan Timblin
2024-01-18 13:26:06 -08:00
committed by GitHub
parent ea5d9db790
commit 40c3ec94b0
2 changed files with 18 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ function parseVin(vin = "") {
return [true, vin.replace(prefix, "")];
}
vin = vin.replace(/[^\p{L}\d]/gu, '');
var re = new RegExp("^[A-HJ-NPR-Z0-9]{8}[0-9X][A-HJ-NPR-Z0-9]{2}[0-9]{6}$");
return [vin.match(re), vin];
}