Skip to content
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

User Rules 里的 matches 能不能支持 regex #1680

Closed
Krysl opened this issue May 2, 2024 · 3 comments
Closed

User Rules 里的 matches 能不能支持 regex #1680

Krysl opened this issue May 2, 2024 · 3 comments
Assignees
Labels
enhancement New update or improvement request

Comments

@Krysl
Copy link

Krysl commented May 2, 2024

您希望的更新和改进是什么 | Update or Improve

有些网页,比如:
https://pub.dev/packages?q=xxx 是一种页面,
https://pub.dev/packages/xxx 是另一种页面。
如果用 "matches": [ "pub.dev/packages*" ], 来匹配,会同时匹配到两个页面。但我想要对两种页面分别配置。
比较理想的方式是使用 正则表达式 或者 glob 。

补充说明 | Additional context

No response

@Krysl Krysl added the enhancement New update or improvement request label May 2, 2024
@theowenyoung
Copy link
Contributor

1.5.1 版本起,match 支持了 Query 参数匹配,所以可以在前面用 "https://pub.dev/packages?", 后面用没有问号的?

@Krysl
Copy link
Author

Krysl commented May 2, 2024

@theowenyoung

之前用的是:

  {
    "matches": [
      "https://pub.dev/packages?*"
    ],
    "selectors": [
      ".packages .packages-description"
    ]
  }

但不管用。

没想到后面不能加 * ,有些无语。。。

matches 里面到底是怎么匹配的?跟 glob 似的却似是而非,想看源码却发现早就闭源了。
还是希望文档里能提几句说明一下。

总之现在是临时解决了我遇到的问题,还是非常感谢的。

@flamintune
Copy link
Collaborator

https://immersivetranslate.com/docs/advanced/#rules-matches-%E5%8C%B9%E9%85%8D%E9%80%BB%E8%BE%91

已在文档中添加了关于 matches 的匹配,欢迎指正。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New update or improvement request
Projects
None yet
Development

No branches or pull requests

3 participants