dtxa49711 2010-08-25 12:08
浏览 7
已采纳

......中的未知修饰符'/'? 它是什么? [重复]

This question already has an answer here:

When i wrote the following, i get such warning, and it doesn't match anything, but i'm sure, that $row_search['content'] contains $value...

preg_match_all("/[^\s]*".preg_quote($value)."[^\s]*/iu", $row_search['content'], $final_matched);

WARNING:preg_match_all() [function.preg-match-all]: Unknown modifier '/' in C:\xampp\htdocs\finance\search\search.php on line 82

why i get such warning message?

Thanks

</div>
  • 写回答

4条回答 默认 最新

  • dongyiluan1718 2010-08-25 12:12
    关注

    I assume $value contains a slash /, which is not escaped by preg_quote:

    The special regular expression characters are: . \ + * ? [ ^ ] $ ( ) { } = ! < > | : -

    Pass the delimiter you use to the function:

    preg_match_all("/[^\s]*".preg_quote($value, '/')."[^\s]*/iu", $row_search['content'], $final_matched);
    //                                        ---^
    

    or use another delimiter.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 pip install后修改模块路径,import失败,需要在哪里修改环境变量?
  • ¥15 爬取1-112页所有帖子的标题但是12页后要登录后才能 我使用selenium模拟登录 账号密码输入后 会报错 不知道怎么弄了
  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥50 vue组件中无法正确接收并处理axios请求
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 MATLAB联合adams仿真卡死如何解决(代码模型无问题)
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决
  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题