Using digits in contextual alternates

I’m trying to add in a contextual alternate for a hyphen when it appears next to a number. I’ve created a class for all the numbers and tried to code this in, but keeping getting an error message. The same thing happens when I just do individual numbers ( sub one hyphen’ by one hyphen.alt’;)…
What am I doing wrong? thanks!

sub @all_digits hyphen’ by hyphen.alt;

thank you!!! :pray: