asp.net - Regex for fixed number in javascript/jquery -


i want validate textfield user enter number like.. should start 'arrn' , upto 5 numeric fields. number can be.. arrn1 or arrn12 or arrn123 not arrn123456 5 numeric allowed.

can have regex same in javascript validate?

i tried regex ['arrn'@[5]] not sure regex syntax.

you can use follwong code check pattern. check pattern in onblur event of input.

$('input').on('blur',function(){    var val = $(this).val();     if(/^arrn\d{1,5}$/.test(val))       alert('val ok');    else    {      //$(this).val('');      alert('val not correct.');      }        });​ 

working fiddle


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -