Tuesday, 27 July 2021

Regex to test time string only

 

https://regex101.com/codegen?language=javascript

const regex = /^(\d{2,4})(\-|\/)(\d{2,4})(\-|\/)(\d{2,4})$/gm;

const str = `2021-12-01`;

regex.test(str)

No comments:

Post a Comment