Regex Tutorial:
Best Site To Learn Tutorial
https://regexone.com/lesson/optional_characters (Will start from this page other pages completed before)
https://regexone.com/lesson/introduction_abcs
https://regexone.com/references/php
https://www.tutorialspoint.com/php/php_regular_expression.htm
example from regex one.com:
Method $has_matches = preg_match($pattern, $input_str, $matches_out) Example // Lets use a regular expression to match a date string. Ignore // the output since we are just testing if the regex matches. $regex = "/[a-zA-Z]+ \d+/"; if (preg_match($regex, "June 24")) { // Indeed, the expression "[a-zA-Z]+ \d+" matches the date string echo "Found a match!"; } else { // If preg_match() returns false, then the regex does not // match the string echo "The regex pattern does not match. :("; }