markdown-to-jsx
markdown-to-jsx copied to clipboard
Possibly redundant regex
In this bit of regex
const HTML_BLOCK_ELEMENT_R = /^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i;
This section: ([^>]*)\/{0}
is meant to capture the attributes of an opening tag. I think that the \/{0}
is redundant. The regex will have been matching anything apart from >
in the previous capture group, so when it finishes matching that it will definitely be at a >
character. Of course, a >
is not /
, so \/{0}
is not needed - it's certain that there will be no /
to match.
I may be wrong about this, however.
Try removing it and see if the tests pass, heh.