python - regex, how to exlude search in match -
might bit messy title, question simple. got in python: string = "start;some;text;goes;here;end" the start; , end; word @ same position in string. want second word some in case. did: import re string = "start;some;text;goes;here;end" word = re.findall("start;.+?;" string) in example, there might few things modify make more appropriate, in actual code, best way. however, string start;some; , search characters included in output. index both ; , , extract middle part, there have way actual word, , not junk too? no need regex in opinion, need capture group here. word = re.findall("start;(.+?);", string) another improvement i'd suggest not using . . rather more specific, , looking else ; , delimiter. so i'd this: word = re.findall("start;([^;]+);", string)