I would write this regexp as `/^when-(\d+|\w+)$/` and then check if an attribute matches this, if it does, then it's a when-foo attribute. we then extract foo, try to convert it to number and that's it