testing user entry on keyup and regex
<p>In my case the requirement is like - </p>

<p>The first name should allow alphabets, some chars like comma, dash and ascent chars.</p>

<p>The code works fine when we try to paste the ascent chars or use "abctajpu" add on in firefox. But as soon as user types in ALT+0192 or any ALT key with num pad. </p>

<p>The keyup function does not work. It lets the user to key in every possible combination with the ALT key.</p>

<p>Here is the sample code..</p>

<pre><code>var namePattern = /^[a-zA-Z,-. \'ÀÈÌÒÙàèìòùÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÃÑÕãñõÄËÏÖÜŸäëïöüŸçÇŠšŽžÅå]$/g;
var negateNamePattern = /[^a-zA-Z,-. \'ÀÈÌÒÙàèìòùÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÃÑÕãñõÄËÏÖÜŸäëïöüŸçÇŠšŽžÅå]/g;
</code></pre>

<hr>

<pre><code>$("#First_Name").bind('keyup paste altKey', function(event) {
  var obj = $(this);
  if (event.type == 'paste') {
     setTimeout(function() {
         validateRealTime(event, obj, namePattern, negateNamePattern)
     }, 1);
  } else {
   validateRealTime(event, obj, namePattern, negateNamePattern);
  }
});
</code></pre>
