how to extract a substring from a variable value inside a template

Hello,

Does someone knows how to extract a substring from a variable?

For example;

name: repo-name/some_dir
subdir: /some_dir

i want to perform in a template something like:

ansible-pull -d /{{ name - subdir }}

and pull contents will be place in /repo-name

is this possible?

Thank you!