Jquery Validate String - only allowing numbers and specific characters
<p>How do I validate a string to only allow numbers and * and # ?</p>

<p>Currently I've got..</p>

<pre><code>    $('body').on('keyup', 'input', function(){
        var str = $(this).val(); 
});
</code></pre>

<p>I'd like to say if str contains anything other that <code>/[0-9*#]/</code> alert('error')</p>

<p>My mind has gone blank on how to do this..</p>

<p>The validation should only allow numbers and * and #  or a blank entry.</p>

<p>it doesn't matter the  order if an invalid character appears anywhere in the string it should error.</p>

<p>Thanks</p>