import re
x = 'STARSHIP_TROOPERS_INVASION_2012_LOCDE'
m = re.search('_\d{4}', x)
print x[:m.end(0)]
