JavaScript
// Write matchDigits(str): the first run of 1+ digits found, or null.
function matchDigits(str) {

}

// Write matchCode(str): the first run of 2 to 4 digits found, or null.
function matchCode(str) {

}