Regular Expression or (Regex) is one of the foremost effective, adaptable, and proficient content preparing approaches. Regex has its possess wordings, conditions, and sentence structure; it is, in a sense, a scaled down programming language.
example:-
This regex is use for Phone number validation
/^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/;This simple regular expression just checks for 2 digits / 2 digits / 4 digits date format
/^\d{2}\/\d{2}\/\d{4}$/Complex regex for date
/^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/If you want to allow only alphanumeric characters, use this regular expression:
/^[a-zA-Z0-9]*$/Decimal Numbers For decimal numbers with one decimal point, the regular expression is:
/^[0-9]+\.?[0-9]*$/If you want to allow only Standard email address
/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/iIf you want supports alphabets and numbers no special characters except underscore(‘_’) min 3 and max 20 characters
/^[A-Za-z0-9_]{3,20}$/;If you want your password supports special characters and here min length 6 max 20 charters only
/^[A-Za-z0-9!@#$%^&*()_]{6,20}$/;