Мне нужно анализировать регулярные выражения в своих компонентах в PHP. У меня нет проблем с созданием регулярных выражений или их выполнением, но я хочу отобразить информацию о регулярном выражении (например, перечислить группы захвата, привязать символы повторения к их целям,...). Общий проект - это плагин для WordPress, который дает информацию о правилах перезаписи, которые представляют собой регулярные выражения с шаблонами замещения, и может быть загадочным для понимания.
Я написал простую реализацию сам, который, похоже, обрабатывает простые регулярные выражения, которые я бросаю на него и преобразовываю их в деревья синтаксиса. Прежде чем расширять этот пример, чтобы больше поддерживать синтаксис regex, я хотел бы знать, есть ли другие хорошие реализации, на которые я могу смотреть. Язык реализации не имеет большого значения. Я предполагаю, что большинство парсеров написано для оптимизации скорости согласования, но это не важно для меня и может даже затруднить ясность.