You can use regular expression for validation for a single line field, not a number field.
[^.]+\.25|[^.]+\.50|[^.]+\.75|[^.]+\.00
Here's a way you can get it working using JavaScript and still have a number field.
//Using the provided element selector and message, add an error message next to the field
function showCustomError(elementSelector, errorMessage)
{
hideCustomError(elementSelector); //remove previous error
$(elementSelector + ' input').addClass('custom-error');
$(elementSelector + ' input').focus();
$(elementSelector + ' input').parent().append('<p class="custom-error-message">' + errorMessage + '</p>');
}
//Hide the custom error generated by the showCustomError function
function hideCustomError(elementSelector)
{
$(elementSelector + ' input').removeClass('custom-error');
$(elementSelector + ' input').siblings('.custom-error-message').remove();
}
$(document).ready( function () {
var formValid = true;
$('#q1 input').on('change', function () {
var num = $(this).val();
if (num.endsWith(.00) == true || num.endsWith(.25) == true || num.endsWith(.50) == true ||num.endsWith(.75) == true)
{
formValid = true;
hideCustomError('#q1');
}
else
{
formValid = false;
showCustomError('#q1', 'Please enter a number ending with .00, .25, .50, or .75');
}
})
$('input[type=submit]').click
(
function(e)
{
if(!formValid)
{
e.preventDefault(); //stop the form from being submitted
showCustomError('#q1', 'Please enter a number ending with .00, .25, .50, or .75.');
}
else
{
hideCustomError('#q1');
}
}
);
});
Borrowed heavily from here.
EDIT: I should clarify that the number field does not have the same "Regular expression for validation" advanced field option as do single line fields. You can still use JS for pattern matching purposes. e.g.
$('#q1 input').on('change', function () {
var num = $(this).val();
if (num.match(/[^.]+\.25|[^.]+\.50|[^.]+\.75|[^.]+\.00/) != null)
{
formValid = true;
hideCustomError('#q1');
}
else
{
formValid = false;
showCustomError('#q1', 'Please enter a number ending with .00, .25, .50, or .75');
}
})