from ogcp import app import re @app.template_filter('remove_id') def remove_id(s): return re.sub(r'_\d+$', '', s)