【发布时间】:2014-11-15 06:07:02
【问题描述】:
我想解析这个字符串并获取特殊值 要解析的字符串具有这些模式之一
app/(integer)/(integer)/(text or null)
app/(integer)/(text or null)
app/(text or null)
我可以使用preg_match 进行简单的使用,但我不能编写可选参数
preg_match('%app/(\d+)/(\d+)/(\.*)$%', $text, $matches)
【问题讨论】:
标签: php regex preg-match optional-parameters optional