I have a simple regex that will not do what I want. I went here and tested the regex and it works:
it's just not working in Python. Why? Thanks in advance.
string =
covid sucks and I want to go outside <!--/* Font Definitions */@font-face{font-family:Wingdings;panose-1:5 0 0 0 0 0 0 0 0 0;}@font-
face{font-family:""Cambria Math"";panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face{font-family:Calibri;panose-
1:2 15 5 2 2 2 4 3 2 4;}@font-face{font-family:""Bradley Hand ITC"";panose-1:3 7 4 2 5 3 2 3 2 3;}/*
Style Definitions */p.MsoNormal, li.MsoNormal, div.MsoNormal{margin:0in;margin-bottom:.0001pt;font-
size:11.0pt;font-family:""Calibri"",sans-serif;}p.MsoListParagraph, li.MsoListParagraph,
div.MsoListParagraph{m{margin-bottom:0in;}--> pop goes the peanut.
desired output = 'covid sucks and I want to go outside pop goes the peanut.'
I want everything between the < >
to go away including the < >
. Also, string is part of a much larger string. Sometimes the <...>
is buried in the middle of a larger string. I need to be able to find it wherever it may be in the larger string and delete it.
My attempts:
string.replace("<.*(?=>)", " ")
and
string.replace("<.*>", " ")