Skip to content

Instantly share code, notes, and snippets.

@andrewpbrett
Created August 15, 2013 20:26
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 andrewpbrett/6244492 to your computer and use it in GitHub Desktop.
Save andrewpbrett/6244492 to your computer and use it in GitHub Desktop.
validDatapoint: function(datapoint) {
var re = /^\s*((?:(?:\d{1,2})\s+){1,3}|\^+\s+)((?:(?:\+|\-)?(?:\d+\.?\d*|\d*\.?\d+))|(?:\d+st[\d\.]*)|(?:(\d+)\:(\d\d)(?:\:(\d\d))?))(\s+\".*?\")?\s*$/;
if(datapoint.length > 0 && !re.test(datapoint)) {
return false;
}
else if (datapoint.match(re) &&
($.trim(datapoint.match(re)[1]) - 0 < 1 ||
$.trim(datapoint.match(re)[1]) - 0 > 31)) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment