Make regex more explicit
This commit is contained in:
parent
d09b6cce04
commit
6902521736
|
|
@ -1,7 +1,10 @@
|
|||
export function validatePostalCode(input: string) {
|
||||
// Remove non-ASCII characters
|
||||
// eslint-disable-next-line no-control-regex
|
||||
input = input.replace(/[^\x00-\x7F]/g, "");
|
||||
if (input.length < 4) {
|
||||
return false;
|
||||
}
|
||||
const regex = /^\d+$/;
|
||||
const regex = /^[0-9]+$/;
|
||||
return regex.test(input);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue