Put the collect input action inside a loop. After the collection (still inside the loop), use a decision action to check to see if the value is within your range. Use this as the expression for the decision action: Contains("12345", Task.digit)
If the decision succeeds, use an update data action to end the loop by setting the loop's index to a value greater than the Loop Count. For example, if you are going to give the caller 3 attempts to pick a valid number, the update data should set the index variable to 4. You might wish to add some audio to the failure outcome of the decision action telling the caller his choice was invalid and the question is going to be repeated. I used this expression:
If(Task.loopIndex+1 < 3, ToAudioTTS("Try again"), ToAudioBlank(1))
to play "try again" except on the last iteration.
You also need to be aware that the collect input action will take the failure path if the caller enters * or #. In this case the value of the Input Data variable will be NOT_SET. The loop will retry in this case as well.
Finally, after the loop action ends you will want to check to make sure you have a valid value in case the caller chose invalid values every time. You can use an Update Data action to check the final value of the Input Data variable and clear/assign it a default value. I used this expression as the value:
If(IsSet(Task.digit) and Contains("12345", Task.digit), Task.digit, "")
to set the value to "" if it wasn't valid. If you do this, remember anytime you interact with this value later in the flow that it could be empty (use the IsNotSetOrEmpty function to check for that). You could also set it to a default value like "1" if that makes sense.
Documentation resources:
https://help.mypurecloud.com/articles/decision-action/
https://help.mypurecloud.com/articles/update-data-data-action/
https://help.mypurecloud.com/articles/using-not_set-expressions/
*also see the expression help in Architect