Oct-13-2023, 06:51 PM
Added
r
.import re input_string =\ """.Myc PGGGGG_UIII_Q9999_AB A0 B11 B22 D1 D2 D3 + 4I 3B""" pattern = r'\.(myc|Myc)\s+([a-zA-Z0-9\_\-]+)\s+(.*)\n(.*)' matches = re.findall(pattern, input_string)[0] print(matches)
Output:('Myc', 'PGGGGG_UIII_Q9999_AB', 'A0 B11 B22 D1 D2 D3', '+ 4I 3B')
>>> matches[0]
'Myc'
>>> matches[-1]
'+ 4I 3B'