php 正则表达式报错,
程序员文章站
2024-02-10 16:35:04
...
php 正则表达式报错,高手请进。
$str = preg_replace("/(?]*)(茶叶)(?!\"|)/sui", '茶叶', $str, 5);
报错如下:
Warning: preg_replace() [function.preg-replace]: Compilation failed: lookbehind assertion is not fixed length at offset 10 in D:\AppServ\www\Template\test.php on line 28
------解决方案--------------------
试试
$str = preg_replace("/(?]*)(茶叶)(?!\"|)/sui", '茶叶', $str, 5);
报错如下:
Warning: preg_replace() [function.preg-replace]: Compilation failed: lookbehind assertion is not fixed length at offset 10 in D:\AppServ\www\Template\test.php on line 28
------解决方案--------------------
试试
- PHP code
$html = 中国茶叶 这儿是中国茶叶大观的链接。 这儿是茶叶的现有链接 html; echo preg_replace('#(?=[^>]*(?=)|$))茶叶#','\0',$html); }相关文章
相关视频