Regx Expression for removing repeated words (case insensitive)
$text = preg_replace("/\s(\w+\s)\1/i", "$1", $text);
Output : ‘Keep your your head’ becomes ‘Keep your head’
Password complexity
Tests if the input consists of 6 or more letters, digits, underscores and hyphens.
The input must contain at least one upper case letter, one lower case letter and one digit.
'\A(?=[-_a-zA-Z0-9]*?[A-Z])(?=[-_a-zA-Z0-9]*?[a-z])(?=[-_a-zA-Z0-9]*?[0-9])[-_a-zA-Z0-9]{6,}\z'
$text = preg_replace("/\s(\w+\s)\1/i", "$1", $text);
Output : ‘Keep your your head’ becomes ‘Keep your head’
Password complexity
Tests if the input consists of 6 or more letters, digits, underscores and hyphens.
The input must contain at least one upper case letter, one lower case letter and one digit.
'\A(?=[-_a-zA-Z0-9]*?[A-Z])(?=[-_a-zA-Z0-9]*?[a-z])(?=[-_a-zA-Z0-9]*?[0-9])[-_a-zA-Z0-9]{6,}\z'
No comments:
Post a Comment