-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
规则求教: 正则匹配之后的自动路径拼接 #1071
Comments
有两种写法: # 正则
/https://domain/path-aaa/ran(\d\d)/path-bbb/file-/ file://X:\mock-domain\path-aaa\rand$1
# 通配符
^https://domain/path-aaa/ran*/path-bbb/file-* file://X:\mock-domain\path-aaa\rand$1 |
感谢作者的帮助,抱歉之前表述的有歧义,其实是想把 提问之前有阅读过帮助文档pattern.html,请问这段描述
应该理解为$1为正则第一次匹配之后剩余的后续url部分?那么$2(对应的子匹配)是什么呢? |
跟正则的子匹配一样,试试: ^https://domain/path-aaa/ran*/** file://X:\固定dir\$2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
有n个待匹配的url例如:
https://domain/path-aaa/ran02/path-bbb/file-d
https://domain/path-aaa/ran67/path-ccc/file-e
其中ran后面为定长2位的随机数
本地目录X:\mock-domain\path-aaa\randxx分别有子目录path-bbb和path-ccc存放了file-d和file-e
写了一条正则rule匹配这类url让他们分别访问对应子目录里的文件:
/https://domain/path-aaa/ran\d\d/path-bbb/file-d/ file://X:\mock-domain\path-aaa\randxx
但实际测试对于任何匹配上的url都会只自动访问到
X:\mock-domain\path-aaa\randxx
,请问有简洁的正则办法让程序在randxx之后根据url自动拼接访问吗?另外不知道whistlek可不可以debug rule(规则)的解析与执行的过程,这样可以自行调试发现自己写的rule在哪里系统解析结果和预想的不一样,就能少提issue来麻烦作者了。
The text was updated successfully, but these errors were encountered: