[Solved] select specific para from text file


You can try below pattern which is working:

import re 

str1 = "StartString fcchwd dheoidfjewofd edeodei eddeed dd djded dojef efjefj fefije efoef;  StartString wdjkndd dwojdpjf wodjojd wdjwjdm wodjow wdjwdjm ojdowj ww wdeswjd wdojwod;  #jfejf  /** hfhih **/ dijhfs wdjw  StartString wkpwkd  dokowdk djd owjidwo;"


regex = re.compile(r'(StartString.+?;)')
l = regex.findall(str1)
print(l)

Output:

C:\Users\Desktop>py x.py
['StartString fcchwd dheoidfjewofd edeodei eddeed dd djded dojef efjefj fefije efoef;', 'StartString wdjkndd dwojdpjf wodjojd wdjwjdm wodjow wdjwdjm ojdowj ww wdeswjd wdojwod;', 'StartString wkpwkd  dokowdk djd owjidwo;']

solved select specific para from text file