Open dejudicibus opened 2 years ago
Would this achieve what you want ?
pattern = ">{:opt}<"
html = "<p><strong>George</strong> is a <em>beautiful</em> cat</p>"
print(''.join(part[0] for part in findall(pattern, html,extra_types=dict(opt=with_pattern(r'.*?')(lambda x:x)))))
outputs
George is a beautiful cat
Let us suppose that I write
I get
Mr. George is a beautiful
To fix that I can write
and now I get
Mr. George is a beautiful cat
However, if I write
I get
<strong>George is a beautiful cat
It looks like the {} placeholder does not like to be empty.