Use regexp to check conditions on strings