RegEx Collection
A collection of Regular Expressions that I use for my projects.
- validation
- regex
A collection of Regular Expressions that I use for my projects.
const areDigitsOnly = (input: any) => new RegExp(/^[0-9]*$/).test(input);function handleChange(event: ChangeEvent<HTMLInputElement>) {
const value = e.currentTarget.value;
if (areDigitsOnly(value)) {
console.log('Digits!');
} else {
console.log('Not all digits');
}
}