Cant call javascript function : I cant seem call the function formValidation from my form. I tried everything but Im pretty sure I'm over-looking something minor

I have to add more text to post this question and hopefully this much is enough

    <!DOCTYPE html>
    <html>
    <head>
    	<title></title>
    </head>
    <body>
    	<script>
    		function formValidation(){
     			var user = document.getElementById("username").value;
                var password = document.getElementById("password").value;
                var userValid = /^[a-zA-Z0-9]{5,10}$/;
                    // username must be between 5 to 10 characters and shouldn't contain special characters
                var passwordValid = /^{8,18}$/;
                    //password must be atleast 8 characters
                
    			if(!userValid.match(user)){
    				alert('Invalid username');
    				return false;
    			}
                echo('test');
    			return true;
            }
    	</script>
    
    <h3>Register New User</h3> 
    
    
    
    
    	<form name = "form1" onsubmit="return formValidation() " action="process.php" method="POST" >
    <!-- 	  Order matters, first JS script run then the next php page visited -->
     		Username:<input type="text" id="username" placeholder="Enter" value="" name="username"> <br>	
            Email ID:<input type="text" name= "email"><br>
            Password: <input type="password" id="password" ><br>
            Confirm Password: <input type="password" id="password" ><br>
    		         <input type="submit" name="button" value="Click here">
    
    	</form>
    
    
    
    
    </body>
    </html>