here i am trying to extract content between pointID and point Name. As shown in below image.
import re
import pandas as pd
import numpy as np
sent1 = 'Date:2020/07/11 13:53 Low Alarm OFF\nAlarm Priority:Urgent\nPoint ID0000294.AI.0017707\nPoint Name:BOM-DC3-B2-2F-Q1-TEMP 3\nAlarm:Normal\nStatus:18.6 øC'
sent2 = 'Date:2020/07/11 13:42 Low AlarmAlarm Priority:UrgentPoint ID0000294.AI.0017707Point Name:BOM-DC3-B2-2F-Q1-TEMP 3Alarm:AbnormalStatus:Analog Lower Limit Alarm 18.0 øC'
def extract_id(sent):
lst=re.split(r'\W+', sent)
lst=str(lst[13]) + str(lst[14]) + str(lst[15])
return(lst)
Here with first sent1 i am able to extract content between pointid but point Name But with the sent2 i am unable to do so . Why because i am splitting the complete sentence in a list and then fetching the list index 13/14/15. which is not same for sent2. Need a solution using Regular expression how can fetch the content between Point ID[Required content]Point Name.

Point ID(\S.*?)[\r\n]*Point Name\bregex101.com/r/FS2HdC/1