Datadog interview question

match a string against a pattern (reimplementing a basic Regexp engine)