« first day  last day (15 days later) » 

8:25 AM
c = ['AB-No.198/241/HDB/2020IA-No.590/2020--D-IA-No.718/2020--D-IA-No.84/2021','ABNo.198/241/HDB/2020-IANo.590/2020-ABNo.198/241/HDB/2021',
'ABNo.198/241/HDB/2021-IANo.590/2020-ABNo.198/241/HDB/2020','AB-NO.-(IB-148-10-NCLT-AHM-2017']
pattern = r"\b(AB)\D*(\d+)\S*?(\d\d)\b(?=\s|[,'/]|-[A-Z]{2}\b|$)"
for s in c:
m = re.search(pattern, s)
if m:
b = m.group(1) + "/" + m.group(2) + "/" + m.group(3)
print(b)
else:
print('No Match:' + s)

Expected Output: AB/198/20, AB/198/20,AB/198/21,AB/148/17
This code isn't working where there are hyphens
after year
 

« first day  last day (15 days later) »