Jump to content

RegExp in JavaScript


blague

Recommended Posts

I wont when i put 1:30 for exampleresult to be 1:30 this function not allow to ":"-this character Please help me !function noLett(e){ var keynum; var keychar; var numcheck; if(window.event) // IE { keynum = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { keynum = e.which; } if (keynum !=8){ keychar = String.fromCharCode(keynum); numcheck = /\d/ return numcheck.test(keychar); } }

Link to comment
Share on other sites

The Regex for matching a string with number and/or the colon would be something like

([0-9]|:)*

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...