我想使用正则表达式使用python提取两个子字符串或短语之间的文本。
示例文本:
NAME – Testing set ADDRESS – 1470 ROAD CONTACT NUMBER - +91-44578558774 E-MAIL – [email protected]
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和之间的所有文本的正则表达式将是什么核心能力?我无法正确使用正则表达式。
要从评论中继续...请尝试作为演示...
import re
pattern = re.compile(r'PROFESSIONAL PROFILE([\s\S]+)CORE COMPETENCIES:')
data = '''
NAME – Testing set ADDRESS – 1470 ROAD CONTACT NUMBER - +91-44578558774 E-MAIL – [email protected]
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.
'''
print(pattern.search(data)[1])
输出:
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.