doubiao9775 2017-01-05 05:49
浏览 36
已采纳

php警告:preg_match()[function.preg-match]:第71行的/sample.php中的未知修饰符'['[重复]

This question already has an answer here:

I am getting the error:

Warning: preg_match() [function.preg-match]: Unknown modifier '[' in /sample.php on line 71

Every time I'm try to run my script.

The code at line 71 is:

if(!preg_match("[h][t][t][p][:][/][/][a-zA-Z0-9\]",$link))

Please help me in fixing this issue..

</div>
  • 写回答

2条回答 默认 最新

  • dongxi0605 2017-01-05 05:56
    关注

    You need delimiters and few modifications in pattern:

    preg_match("/http:\/\/[a-zA-Z0-9\\\\]/",$link)
    
    1. Missing delimeters for pattern : /pattern/
    2. No need of too many [ ]
    3. If you need \, you should escape with \ so \\\\ [Read this SO answer to know why you need three backslash to escape a backslash]
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器