Regex to match markdown links

Handy little regular expression to parse links from markdown files.

var regexMdLinks = /\[([^\[]+)\](\(.*\))/gm
var mdContents = `
Lorem ipsum dolor sit amet, consectetur adipiscing elit..

[hello link](/admin/table_edit/table_edit.cfm?action=edit&table_name=organizationsXcategories)

Lorem ipsum dolor sit amet, consectetur adipiscing elit..

[otherLink](https://google.com)

Lorem ipsum dolor sit amet, consectetur adipiscing elit..

[third link](https://google.com)
`

var matches = mdContents.match(regexMdLinks)
console.log('links', matches)

var singleMatch = /\[([^\[]+)\]\((.*)\)/
for (var i = 0; i < matches.length; i++) {
  var text = singleMatch.exec(matches[i])
  console.log('Link #' + i, text)
}

Comment below if you have any questions or updates to this snippet!