"rejects any other number" -- what kind of data are you expecting as input and what is the format of the data?
Here's my expression:
'^[0-3]$|^0\.5$'
This means: At the start of the line (^) there should be a 0, 1, 2, or 3 ([0-3]), and then be the end of the line ($) OR at the start of the line (^) there should be a 0.5 (\. means period, . by itself means any single character in this context) then the end of the line ($).
Here's my test file:
0
0.25
0.5
0.51
1
1.5
2
3
4
5
6
7
Here's the output:
0
0.5
1
2
3
But that won't work if they aren't on separate lines..