对于正则的修饰符 isU 说明:
i: 表示in-casesensitive,即大小写不敏感
s: PCRE_DOTALL,表示点号可以匹配换行符。
U: 表示PCRE_UNGREEDY,表示非贪婪,相当于perl/python语言的.*?,在匹配过程中,对于.*正则,一有匹配立即执行,而不是等.*搜索了所有字符再一一返回
在使用正则表达式时,我们应该尽量避免递归调用,递归容易导致堆栈溢出。比如:
/<table((?!<table).)*?</a>/isU 就会发生错误,而使用 /<table.*?</a>/i 就正常。
那么如何增加win平台下 ThreadStackSize 的大小呢? 在apache的配置文件 httpd.conf 里启用 “Include conf/extra/httpd-mpm.conf”(删除前面的注释#),然后在 httpd-mpm.conf 文件里的 mpm_winnt_module 配置模块里设置 “ThreadStackSize 8400000”即可(大约8M)。
<IfModule mpm_winnt_module>
ThreadStackSize 8400000
ThreadsPerChild 200
MaxRequestsPerChild 10000
Win32DisableAcceptEx
</IfModule>
这里需要注意的是,32位的Apache程序只能最多使用大约2GB内存空间! 因此,ThreadStackSize 和ThreadsPerChild 的值相乘后(8M * 200)不应该超过2G,否则无法启动apache,出现的错误日志如下:
[Thu Apr 11 20:02:45 2013] [crit] (OS 8)存储空间不足,无法处理此命令。 : Child 4832: _beginthreadex failed. Unable to create all worker threads. Created 212 of the 220 threads requested with the ThreadsPerChild configuration directive.
通过上面的提示,小编可以告诉大家的是在我的这台服务器上,当线程堆栈大小设为8M时,我可以设置的线程数最多是212个。
您可能感兴趣的文章:
PHP函数preg_match_all正则表达式的基本使用详细解析PHP 正则表达式之正则处理函数小结(preg_match,preg_match_all,preg_replace,preg_split)php中preg_match的isU代表什么意思PHP中preg_match函数正则匹配的字符串长度问题PHP中preg_match正则匹配中的/u、/i、/s含义PHP的preg_match匹配字符串长度问题解决方法PHP preg_match的匹配多国语言的技巧php小经验:解析preg_match与preg_match_all 函数php中使用preg_match_all匹配文章中的图片php preg_match_all结合str_replace替换内容中所有imgPHP preg match正则表达式函数的操作实例