Skip to content

Instantly share code, notes, and snippets.

Created January 2, 2017 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/0b0e94d211521a0678a552489c1bf2c5 to your computer and use it in GitHub Desktop.
Save anonymous/0b0e94d211521a0678a552489c1bf2c5 to your computer and use it in GitHub Desktop.
function isValid(sample) {
var regexp = /(?:\d{2}\.){2}\d{2}(?:\-{1}(?:\d{2}\.){2}\d{2})?;\s?/;
console.log(regexp.test(sample));
}
Формат нарушен, но true
isValid('22.11.16-23.11.18; 231116')
isValid('22.11.16------23.11.16;')
// true
Формат правильный, но false
isValid('22.11.16-23.11.16 ;23.11.16')
//false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment