Javascript examples for RegExp:RegExp test
Function to determine if a string contains characters only from another
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*ww w.ja v a 2s. co m*/ function isChar(str) { return /^[a-zA-Z()]+$/.test(str); } var allowed = 'abcdefghijklmnopqrstuvwxyz'; if(isChar(allowed )){ console.log('a-z cool :)'); }else{ console.log('Enter only Char between a-z'); } } </script> </head> <body> </body> </html>