Pergunta de entrevista da empresa FactSet

Given a set of rules for a general expression, create a general expression to find X