We should run `preg_match` by searching for `$pattern` within an empty string and check if it returns `false` instead of running an own validation pattern on `$pattern`. The triggered error message can be catched and used as previous exception message.