Validate Email & Password with Regular Expression
In this video we will learn, how to validate an email address and password client side, by using regular expressions (regex). This way we can check, if the inserted email address is formed like an email address, and if the password contains certain characters, like upper and lower case letters, digits and special characters. For this we will use the Pattern class, with which we can compile a regex from a string and then use the matcher method to compare it with the input. In build.gradle file add this dependency:- implementation 'com.google.android.material:material:1.0.0' In MainActivity.java class file add these lines of codes:- import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Patterns; import android.view.View; import android.widget.Toast; import com.google.android.material.textfield.TextInputLayout; import java.util.regex.Pattern; public class MainActivity extends AppCompatActivity { private static final Pattern PASSWORD_P...