ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[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 ```