Regex Tuesday Challenge - Week Nine

Another MarkDown challenge! This challenge is simply to parse MarkDown links - so [text](http://example.com) would simply be replaced with the following HTML: <a href="http://example.com">text</a>.

Be careful with images. ![alt text](image location) should be left alone, as it isn't a link.

If you don't want to write an expression for URLs too, you can see answers to the previous challenge on URLs on Reddit.

To test a regular expression on the test cases below, type it into the text input. Each test case will be marked as passed or failed respectively - you are aiming to get as many test cases as you can to pass. Note that JavaScript must be enabled for this feature to work. The regex engine used is the JavaScript regex engine; it is similar to PCRE, but with a few differences.

Test cases (0/17)

[Basic link](http://example.com)
<a href="http://example.com">Basic link</a>
[Another](http://example.com/)
<a href="http://example.com/">Another</a>
Link: [lynx.io](http://lynx.io/)
Link: <a href="http://lynx.io/">lynx.io</a>
[Text](http://test.this-test.com/)
<a href="http://test.this-test.com/">Text</a>
[Test!](http://this-test.test.com) hello
<a href="http://this-test.test.com">Test!</a> hello
l [l](http://TESTdomain.com) l
l <a href="http://TESTdomain.com">l</a> l
[number](http://0test.com/)
<a href="http://0test.com/">number</a>
[Invalid](invalid://example.com)
[Invalid](invalid://example.com)
[Invalid](mailto:nobody@example.com)
[Invalid](mailto:nobody@example.com)
[Invalid](javascript:alert())
[Invalid](javascript:alert())
[Invalid](http://test_ing.com)
[Invalid](http://test_ing.com)
[Invalid](http://inval.id,com)
[Invalid](http://inval.id,com)
![Image](http://example.com/cats.jpg)
![Image](http://example.com/cats.jpg)
![Other image](cats.jpg)
![Other image](cats.jpg)
l[Invalid MarkDown](http://example.com)
l[Invalid MarkDown](http://example.com)
[[Invalid MarkDown](http://example.com)
[[Invalid MarkDown](http://example.com)
[Invalid MarkDown](http://example.com)l
[Invalid MarkDown](http://example.com)l
Congratulations, your regex passes all the test cases! Remember to share this challenge.