A parser for regular expressions in PHP?

后端 未结 6 1560
忘了有多久
忘了有多久 2021-02-04 01:28

I need to parse regular expressions into their components in PHP. I have no problem creating the regular expressions or executing them, but I want to display information about t

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-04 02:04

    You may be interested in a project I did last summer. It is a Javascript program which provides dynamic syntax highlighting of PCRE compatible regular expressions:

    See: Dynamic (?:Regex Highlighting)++ with Javascript!
    and the associated tester page
    and the GitHub project page

    The code uses (Javascript) regex to pick apart a (PCRE) regex into its various parts and applies markup to allow the user to mouse over various components and see the matching brackets and capture group numbers.

    (I wrote it using regex because I didn't know any better! 8^)

提交回复
热议问题