【发布时间】:2020-03-22 08:44:51
【问题描述】:
我想使用 python 使用正则表达式提取两个子字符串或短语之间的文本。
示例文本:
NAME – Testing set ADDRESS – 1470 ROAD CONTACT NUMBER - +91-44578558774 E-MAIL – test.side@gmail.com
PROFESSIONAL PROFILE
A petroleum graduate with professional experience in workover operation & Surface Well Testing operation and implementation of procedures and best practices following knowledge management processes. Seeking a role in oil and gas industry to develop engineering and management skills and apply new ideas to real life industry problem.
PROFESSIONAL EXPERIENCE
RIG (JUN 2014 – SEPT 2015)
Performed various workover operations in SRP and ESP wells developed in Ahmedabad (ONGC Project) & Durgapur (ESSAR Project). My responsibilities as Roustabout on Rig was to perform: Make pipe connection & Operate Tongs while running in and Pull out of Sucker rod & Tubings.
CORE COMPETENCIES:
1. Well versed with varioussoftware for well testing (Wireless software). 2. Good Knowledge of MS-EXCEL, MS-Word.
正则表达式用于提取 PROFESSIONAL PROFILE 和 核心竞争力? 我无法正确使用正则表达式。
【问题讨论】:
-
也许:
PROFESSIONAL PROFILE([\s\S]+)CORE COMPETENCIES:将其放入第 1 组 (\1)。最好发布尝试并要求改进或您发现不起作用,而不仅仅是说明所需的任务;o) -
我尝试了相同的表达式,但没有得到输出。抱歉错过了发布我的尝试
-
我会发布一个答案来显示一些代码,因为在 cmets 中显示太棘手了