How to prevent users from entering invalid characters inside an input field
<p>Given a text input field. How can I prevent users from entering spaces, and other other than  letters numbers or dashes (-).</p>

<p>Alphanumerics only - "The alphanumeric character set consists of the numbers 0 to 9 and letters A to Z. In the perl programming language, the underscore character ( _ ) is also considered to be a member of the alphanumeric set of characters"</p>

<p>This is for a field where users can pick a custom url. I would like to prevent users from entering invalid characters.</p>

<p>Ideas? Thanks</p>
