[英]php regular expression match prbl about starting with one string but not the other
[英]Regular Expression match URL starting with a path but excludes one or more subpaths
我正在嘗試匹配 PHP 中的 URL,其中以路徑開頭的所有路徑都匹配但不包括子路徑。 例如,我想匹配任何以/admin
開頭的路徑,但不匹配以/admin/auth
開頭的路徑。
要匹配的示例路徑: /admin/dashboard
示例路徑不匹配: /admin/auth/login
我嘗試過但不起作用的方法: #^/admin(?<./auth)/.*$#
知道了! #^/admin/(?.auth/).*$#
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.