Or you could use the traffic light node.
This will not change the payload just stop messages that you don’t want to pass.
[{"id":"bc399d7a.693ed","type":"traffic","z":"ebaa69a9.649708","name":"","property_allow":"payload","filter_allow":"\\d+","ignore_case_allow":false,"negate_allow":false,"send_allow":true,"property_stop":"payload","filter_stop":"\\w+","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":230,"y":520,"wires":[["777caa3e.1ec134"]]},{"id":"df9e7d98.0ad43","type":"inject","z":"ebaa69a9.649708","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":80,"y":520,"wires":[["bc399d7a.693ed"]]},{"id":"777caa3e.1ec134","type":"debug","z":"ebaa69a9.649708","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":520,"wires":[]}]
This will now only allow numeric payloads.