I have a line from a blast file with the score of an alignment:
Score = 344 bits (186), Expect = 5e-91
I am trying to use regex in a python script (I know biopython would make my life much simpler, but I am not allowed to use it) to extract only the "344" value. In the file I have a multitude of scores, so I can't just use the string "344" in my regex to extract the value.
Right now, the code I have is:
score_list = []
for record in blast_file:
score = re.search(r'Score = (.+\d)', record).group(1)
score_list.append(score)
print(score_list)
That being said, the output I get is:
344 bits (186), Expect = 5e-91
How to I edit the regex so that I only get the "344" or whatever value is before the " bits"?