title: Regular expression to check contains only
body: <p><strong>EDIT:</strong> Thank you all for your inputs. What ever you answered was right.But I thought I didnt explain it clear enough.</p>
  
  <p>I want to check the input value while typing itself.If user is entering any other character that is not in the list the entered character should be rolled back.</p>
  
  <p>(I am not concerning to check once the entire input is entered).</p>
  
  <p>&nbsp;&nbsp;&nbsp;
  I want to validate a date input field which should contain only characters <code>0-9[digits], -(hyphen) , .(dot),</code> and <code>/(forward slash)</code>.Date may be like <code>22/02/1999</code> or <code>22.02.1999</code> or <code>22-02-1999</code>.No validation need to be done on either occurrence or position. A plain validation is enough to check whether it has any other character than the above listed chars.
  [I am not good at regular expressions.]<br/></p>
  
  <p>Here is what I thought should work but not.</p>
  
  <pre><code>  var reg = new RegExp('[0-9]./-');
  </code></pre>
  
  <p>Here is <a href="http://jsfiddle.net/gWPVh/1/" rel="nofollow">jsfiddle.</a></p>