Want some help regrading set_fact variable when condition

Hi team I am using set_fact module to get output variable with regular expression.