def METHOD_NAME(
    lookup_tables: Dict[Text, List[Text]],
    regex_features: Dict[Text, Text],
    use_lookup_tables: bool,
    use_regex_features: bool,
):
    """Tests if exception is raised when regex patterns are invalid."""
    training_data = TrainingData()
    if lookup_tables:
        training_data.lookup_tables = [lookup_tables]
    if regex_features:
        training_data.regex_features = [regex_features]
    with pytest.raises(Exception) as e:
        pattern_utils.extract_patterns(
            training_data,
            use_lookup_tables=use_lookup_tables,
            use_regexes=use_regex_features,
        )
    assert "Model training failed." in str(e.value)
    assert "not a valid regex." in str(e.value)
    assert "Please update your nlu training data configuration" in str(e.value)