I need to validate a Google Analytics tracking ID. So I created a simple function but my RegEx must be wrong because it just returns false everytime. I'm not sure if there is a set amount of digits in the middle or at that end of a Google Analytics ID so was just trying to just look for at least one digit.
JavaScript Function:
function validateGA(id) {
var regexp = /ua-\d+-\w\d+/;
return regexp.test(id);
}
Tested with validateGA('UA-12345-12'); but just keep returning false.
JSFiddle: http://jsfiddle.net/g9yLr/