@Test
public void testDynamicModifications() {

    String message = "hello\nend";
    AtomicReference<String> config = new AtomicReference<>(".*hello.*");
    Function<String, Matcher> matcher = RegExpExt.dynamicMatcher(() -> config.get(), Pattern.DOTALL, e -> {
        throw new IllegalStateException(e);
    });
    assertThat(matcher.apply(message).matches()).isTrue();
    config.set(".*foobar.*");
    assertThat(matcher.apply(message).matches()).isFalse();
}