Pregunta de entrevista de Datadog

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