Python If Variable Regular Expression To Finite