捕获以特定单词开头和结尾的文本列表

时间:2019-07-10 18:25:43

标签: regex python-3.x

我想使用正则表达式和python

进行捕获
Date List-of-Admins-Meeting
Duration List-of-Admins-Meeting
VideoLink List-of-Admins-Meeting
Date List-Of-Admins-
Duration List-Of-Admins-
VideoLink List-Of-Admins-

所需输入:

list=["Date List-of-Admins-Meeting Duration List-of-Admins-Meeting VideoLink List-of-Admins-Meeting Date List-Of-Admins- Duration List-Of-Admins- VideoLink List-Of-Admins-"]

所需的输出:

List_of_Dates=["Date List-of-Admins-Meeting","Date List-Of-Admins-"]
List_of_Duration=["Duration List-of-Admins-Meeting","Duration List-Of-Admins-"]
List_of_VideoLink=["VideoLink List-of-Admins-Meeting","VideoLink List-Of-Admins-"]

我想用日期,持续时间和VideoLink捕获所有标签,但是标题名称会发生​​变化,如上面所示。

任何帮助将不胜感激

这是我到目前为止的代码

 regex = re.compile('\s([List])\w+\-([f])')

0 个答案:

没有答案