Regular expression to validate a Google Analytics UA Number
- by Otis
It's not 100 percent clear to me that the Google Analytics UA Numbers are always 6 digits, a dash, and 2 digits as Google often mentions in their documentation. There are frequent counter-examples that use fewer than 6 for the account portion and 1-4 for the profile. All of the examples always show numbers but it's not even clear that they can't be letters.
Does anyone know if Google has published a regex that exactly matches allowable UA Numbers? I'm adding this feature to the admin console of an application I work on and would like to validate the user input.