我有一个 PHP 数组,其 URL 如下所示:
http://example.com/apps/1235554/
http://example.com/apps/apple/
http://example.com/apps/126734
http://example.com/images/a.jpg
http://example.com/images/b.jpg
http://example.com/apps/2331234/
http://example.com/apps/orange/
如何使用正则表达式分离出这些 url 并将它们推送到另一个数组:
http://example.com/apps/1235554/
http://example.com/apps/126734
http://example.com/apps/2331234/
仅有网址apps/{number}/
and apps/{number}
应该被选择。
假设您不使用“/”作为正则表达式分隔符来忽略转义问题,这将解决问题:
"^http://example.com/apps/\d+/?$"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)