regex - get string in between with python -
looking way items in between tabs
\t_e\t1\t_
i need 1 in other cases longer string.
re.search("\t_e\t(.*)\t_", string).group(1)
9 times out of 10 line returns string/value want not always, clear after underscore letter white space.
try making regex lazy adding ?
character after *
, so:
re.search("\t_e\t(.*?)\t_", string).group(1) ^
this makes .*
match little possible until next \t
(and prevents .
eat \t
).
Comments
Post a Comment