drza10046 2013-01-24 16:49
浏览 114
已采纳

php glob模式匹配任意位数

Is it possible to match an arbitrary number of digits with the php glob function? I'm trying to match file names for image thumbnails that end with dimensions ranging from two to four digits.

I know I can supply a digit range, but this only matches a single character:

glob("thumbname-[0-9]-[0-9].jpg")

This will match thumbname-1-1.jpg but not thumbname-10-10.jpg, etc.

  • 写回答

3条回答 默认 最新

  • dongtun4268 2013-01-24 17:01
    关注

    Try using: glob("thumbname-[0-9]*-[0-9]*.jpg")

    I made a test and it works for me.

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

报告相同问题?

悬赏问题

  • ¥15 vc6.0中想运行代码的时候总是提示无法打开文件是怎么回事
  • ¥25 关于##爬虫##的问题,如何解决?:
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题