I need to find poorly-formed markdown that breaks a particular markdown parser. I'm in search of a RegEx which will find cases where **bold text** is incorrectly padded with a space before or after the asterisks. For example ** this is wrong** and **this is also ** as is ** this one too **, but **this is correct**. Naturally, lines can often contain both. For example, here are some test cases:
This line is **correct** and **properly marked down**.
But this line **is not** because ** the second bold is wrong**.
** Also** this line is wrong **even though this is right**.
I've tried (?:\*\*[^\*]*\s\*\*), but that actually captures the parts between (the parts not enclosed in asterisks). Any advice?