Validate image sizes expressed as e.g. 5X4 using JavaScript - Javascript RegExp

Javascript examples for RegExp:Match Number

Description

Validate image sizes expressed as e.g. 5X4 using JavaScript

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {/* ww w .  ja  v a2s . c o  m*/

var pattern = /[0-9]\X[0-9]/;
inp = "1X2"; //Sample
if(!pattern.test(inp)){
    console.log("Error");
}


    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials