我想写正则表达式,如
/调度/组/成员/ [列表* |得到* |搜索*] JSON
。
应与字符串
匹配 /scheduling/groups/list.json
或
/scheduling/groups/getGroup.json
或
/scheduling/groups/searchMember.json
且不应与
匹配/scheduling/groups/save.json
答案 0 :(得分:1)
答案 1 :(得分:1)
甚至可以使用像
这样的东西 # (?i)/scheduling/groups/(?:list|get|search)[^/]*\.json
(?i) # Case insensitive modifier
/scheduling/groups/ # Literal '/scheduling/groups/'
(?: # Cluster group, one of either
list # 'list'
| # or,
get # 'get'
| # or,
search # 'search'
) # End cluster group
[^/]* # 0 - many characters that are non filename separators
\. json # to get to '.jason'