How can i form a regular expression which identifies a valid whole number without decimal places?

Platform: ASP.NET| Category: Client Side Scripting

The regular expression used to identify only the numbers is var regexp = /\D|\./.


<script> 
function IdentifyNumbers() 
{ 
	var Number = document.getElementById('NumericValue').value; 
	var regexp = /\D|\./ ; 
	if(Number.match(regexp)) 
	{
		alert('Only enter numbers and no decimal point\nInvalid input: '+Number.match(regexp));
	} 
	else
	{
		alert('Valid Input');
	}
} 
</script>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.