これに類似した文字列があります。2つの特殊文字の間のテキストを含めると無視する
str1=r'<st-button mode="positive" width="small" can-click="{loadConference}" id="meetingPasswordButton">{{i18n "ok"}}</st-button>'
私は<
と>
間のすべてのものを含めると</
と>
の間のすべてを拒否したいです。
次のコードを使用して、これらの特殊文字の間にテキストを含めて拒否しようとしました。しかし、私は出力を得ることができません。この状況を打破するために私を助けてください。
コード:<
と>
の間でデータを返します
import re
pat = r'(?<=\<).+?(?=\>)' or r'(?<!\</).+?(?!\>)'
s = r'<st-button mode="positive" width="small" can-click="{loadConference}" id="meetingPasswordButton">{{i18n "ok"}}</st-button>'
print (re.findall(pat, s))
読む[この](HTTP: //stackoverflow.com/a/1732454/ 2276527) – Gogo