🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## preg_last_error 最近一次的正则匹配错误 ``` preg_match('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar'); if (preg_last_error() != PREG_NO_ERROR) { switch (preg_last_error()) { case PREG_INTERNAL_ERROR: echo "PREG_INTERNAL_ERROR"; break; case PREG_BACKTRACK_LIMIT_ERROR; echo "PREG_BACKTRACK_LIMIT_ERROR"; break; case PREG_RECURSION_LIMIT_ERROR; echo "PREG_RECURSION_LIMIT_ERROR"; break; case PREG_BAD_UTF8_ERROR; echo "PREG_BAD_UTF8_ERROR"; break; case PREG_BAD_UTF8_OFFSET_ERROR; echo "PREG_BAD_UTF8_OFFSET_ERROR"; break; } } // output: // PREG_BACKTRACK_LIMIT_ERROR ```