I am using Python 2.7. The current code returns hello }{(2) world
. If I only want the shortest match, in this case hello
, what is the solution in Python 2.7?
import re
content = '{(1) hello }{(2) world}'
reg = '{\(1\)(.*)}'
results = re.findall(reg, content)
print results[0]