If condition on a filtered variable in template

How can I do this in a template ?

{% if request.path | slice:'1:2' == '@' %}
XXX
{% endif %}

Apparently there shouldn’t a space surrounding |
{% if request.path|slice:'1:2' == '@' %}