Regular expression to validate a Google Analytics UA Number

Posted by Otis on Stack Overflow See other posts from Stack Overflow or by Otis
Published on 2010-03-23T02:54:39Z Indexed on 2010/03/23 8:33 UTC
Read the original article Hit count: 333

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about google-analytics

Related posts about regex