Javascript examples for RegExp:Match Number
Validate image sizes expressed as e.g. 5X4 using JavaScript
<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>