I am trying to capture words that come after a certain pattern \d+", I want to capture all the words after the pattern until "&" or a number is found in the word.
this is what I have so far
import re
tests = ['the size will be 12" QTR', 'size is 7" gnh H&M','size is 12" GNH.M gm H&M', 'sizes are 12" QTR gm Best&SAP for all ages', 'size is 14" qtr 14GM']
for i in tests:
temp = re.search('\d+"\s+([A-Za-z.\s]+)', i).groups()[0]
print(temp)
the expected output is
QTR
gnh
GNH.M gm
QTR gm
qtr