I have a csv file with below string structure:
JavaScript
x
6
1
Modem Switch (MMA-213-MML-NW-Match-New Year)(32655)(12532)
2
Modem Switch3 (MMA-1234-431-NW-Match-New Month)(32655)(12532)
3
Modem Switch3 (MMA-1234-431-NW-Match-New1 Month)(32655)(12532)
4
Modem Switch3 (MMA-1234-431-NW-Match-New Month 2)(32655)(12532)
5
.
6
I want to get any string which comes after Match: For example the expected result shared as below:
JavaScript
1
5
1
New Year
2
New Month
3
New1 Month
4
New Month 2
5
with below code it is not possible to get my relative string:
JavaScript
1
2
1
matches = re.findall(r'(Match-)(w+)', inp, flags=re.I)
2
Advertisement
Answer
This works:
JavaScript
1
4
1
import re
2
inp = "Modem Switch3 (MMA-1234-431-NW-Match-New Month)(32655)(12532)"
3
matches = re.findall(r'Match-(.+?))', inp, flags=re.I)
4
gives
JavaScript
1
2
1
['New Month']
2