Regex with group matching in JS
MDN on exec function https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
var regex = /([0-9]{4})([0-9]{2})/;
var s = "201601201601201601201601201601201601201601";
var match = regex.exec(s);
var year = match[1];
var week = match[2];
console.log(match, year, week)
var s2 = "2A1601";
var match2 = regex.exec(s2);
console.log(match2);