Regex Tuesday Challenge - Week Four

This weeks Regex Tuesday Challenge is to write part of a MarkDown parser - turn italic MarkDown (*this is italic*) into HTML italic: <em>this is italic</em>. It should not, however, match bold text - text surrounded by multiple asterisks.

This is a somewhat unrealistic challenge - in real life, you wouldn't have to make sure that it isn't bold, as you would have already parsed the bold text.

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/11)

This text is not italic.
This text is not italic.
*This text is italic.*
<em>This text is italic.</em>
This text is *partially* italic
This text is <em>partially</em> italic
This text has *two* *italic* bits
This text has <em>two</em> <em>italic</em> bits
**bold text (not italic)**
**bold text (not italic)**
**bold text with *italic* **
**bold text with <em>italic</em> **
**part bold,** *part italic*
**part bold,** <em>part italic</em>
*italic text **with bold** *
<em>italic text **with bold** </em>
*italic* **bold** *italic* **bold**
<em>italic</em> **bold** <em>italic</em> **bold**
*invalid markdown (do not parse)**
*invalid markdown (do not parse)**
random *asterisk
random *asterisk
Congratulations, your regex passes all the test cases! Remember to share this challenge.