Password error message

Hello,
I have a regex on my password and want an error message to show if the user does not create a strong enough password.

I need the code to show the error message when the password is not filled out correctly and disappears when the password is correct.

would i use ‘If’ , ‘else’ code?