Regex: what does (?! …) mean?

前端 未结 6 1655
既然无缘
既然无缘 2021-02-12 21:46

The following regex finds text between substrings FTW and ODP.

/FTW(((?!FTW|ODP).)+)ODP+/

What does the (?!...) do?

6条回答
  •  半阙折子戏
    2021-02-12 22:31

    The programmer must have been typing too fast. Some characters in the pattern got flipped. Corrected:

    /WTF(((?!WTF|ODP).)+)ODP+/
    

提交回复
热议问题