I have the following regex from this post:
\<([\w]+)([^\>]*?)(([\s]*\/\>)|(\>((([^\<]*?|\<\!\-\-.*?\-\-\>)|(?R))*)\<\/\1[\s]*\>))
This regex matches any html
code.
When I test it on RegExr and regex101 it works fine.
However when I test it with the following code in Python...
re.finditer('\<([\w]+)([^\>]*?)(([\s]*\/\>)|(\>((([^\<]*?|\<\!\-\-.*?\-\-\>)|(?R))*)\<\/\1[\s]*\>))', data):
... I get this error: unexpected end of pattern
.
Does anyone know how to fix this?