function firstRegexMatch(regex, string) {
  var matches = regex.exec(string)
  return (matches && matches.length > 1) ? matches[1] : null
}
Given a string an a regular expression
Return the first match, or null if there isn't any