Yeah. I missed the fact that Regex.compile/2 returns a tuple which indicates correctness of the regex while using the small-r sigil is like using a banged version which might crash.
Therefore let me summarize, that one can choose among different possibilities to achieve what was asked for, depending on ones usecase:
Regex.compile/2if one wants to control what happens if an invalid RegEx is created~r//with String interpolation (#{varname}) if it is OK if the process dies on an invalid RegEx


















