I try to write a simple Markdown parser in JavaScript. Therefore I want to check for the [link content][link id] syntax. I use the following code:
[link content][link id]
You need to double escape:
var r = new RegExp( '\\[(.*?)\\][ ]*\\[([0-9]+)\\]', 'g' )