Sanitization of User-Supplied Regular Expressions in PHP

前端 未结 5 856
盖世英雄少女心
盖世英雄少女心 2020-12-20 21:03

I want to create a website where users can test regular expressions (there are many out there already...such as this one: http://www.pagecolumn.com/tool/pregtest.htm). Basic

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-20 22:05

    The only problem I can think of is that someone can DOS you by entering a bad regex (one that is O(2^n) or O(n!) or whatever), and the easiest way to prevent this might be to set your page timeout short.

提交回复
热议问题