Regex to match md5 hashes

match, php, regex

Solution

This is a PCRE that will match a MD5 hash:

define('R_MD5_MATCH', '/^[a-f0-9]{32}$/i');

if(preg_match(R_MD5_MATCH, $input_string)) {
    echo "It matches.";
} else {
    echo "It does not match.";
}

Problem

What type of regex should be used to match a md5 hash. how to validate this type of string `00236a2ae558018ed13b5222ef1bd987` i tried something like this: `('/^[a-z0-9]/')` but it didnt work. how to achieve this? thanks

Original source