在特定字符正则表达式之间查找文本

时间:2021-07-04 19:32:27

标签: python regex

data="""
<section class="descr"><a href="https://audioz.
download/uploads/posts/2020-04/1588148680_2020-
04-29_112330.jpg" rel="highslide" 
class="highslide thumbnail"><img src="https://
audioz.download/uploads/posts/2020-04/thumbs/
1588148680_2020-04-29_112330.jpg" data-src="https://audioz.download/uploads/posts/2020-04/thumbs/1588148680_2020-04-29_112330.jpg" class=
"thumbnail" itemprop="image" alt="Capella 
v8.0.16-CRD screenshot"></a><br><mark class=
"subtitle"> CRD | 06.2020 | 129 MB</mark><br>
With capella you can instantly create complete 
scores … No other notation program will take you 
by the hand and gently guide you towards your first own score in the manner in which capella does it. There is no need to be fully computer literate - you just follow your musical imagination and capella does 
the rest. Within no time you will have completed your first score sheet.</section> """

我想最后用正则表达式提取文本。 输出应该是:

With capella you can instantly create complete 
scores … No other notation program will take you 
by the hand and gently guide you towards your first own score in the manner in which capella does it. There is no need to be fully computer literate - you just follow your musical imagination and capella does 
the rest. Within no time you will have completed your first score sheet.

我该怎么做?我在 Python 中所做的是:

import re
reg = re.compile(r'(?<=\<\/mark\>\<br\>)(.*)(?=\<\/section\>)')
mo = reg.search(data)

mo.group()

但是有没有更有效的方法来做到这一点?

0 个答案:

没有答案