Javascript Alphanumeric regular expression taking new line character - Javascript RegExp

Javascript examples for RegExp:RegExp Match

Description

Javascript Alphanumeric regular expression taking new line character

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
  <script type="text/javascript">
    $(function(){//from   w  w w  .j  a  v a 2  s.  c  o  m
$("#textArea1").change(function(){
var regex = new RegExp(/^[0-9a-zA-Z\s\r\n]+$/);
console.log(regex.test($("#textArea1").text()));
})
    });

      </script> 
 </head> 
 <body> 
  <textarea id="textArea1">
</textarea>  
 </body>
</html>

Related Tutorials