I'm trying to validate the password without using regex but it didn't work what I'm trying to do is the password must contain at least one uppercase letter, one lowercase letter, one number, and one alphanumeric character. but without using Regex
here is my code
import * as React from "react";
import { useForm } from "react-hook-form";
function Form() {
const { register, handleSubmit, errors } = useForm();
const onSubmit = (data) => {
console.log(data);
};
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input
type="password"
placeholder="password"
name="password"
ref={register({required:true,minLength:8, maxLength:16, upperCase:'true' , lowerCase:'true' )}
/>
<input type="email" placeholder="email" name="Email" ref={register} />
<br />
Birthday
<input
type="date"
placeholder="birthday"
name="birthday"
ref={register}
/>
<br />
<input type="submit" />
</form>
);
}
export default Form;
I have looked at many sites but I couldn't find any solutions!