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

Document usage of Named Regex groups in replacement patterns #326

Open
AndreyNautilus opened this issue May 26, 2024 · 0 comments
Open

Document usage of Named Regex groups in replacement patterns #326

AndreyNautilus opened this issue May 26, 2024 · 0 comments

Comments

@AndreyNautilus
Copy link

AndreyNautilus commented May 26, 2024

It would be great to document the usage of Named Regex groups in "replacementPatterns".
For example:

{
  "replacementPatterns": [
    {
      "pattern": "assets/(?<filename>.*)",
      "replacement": "images/$<filename>"
    }
  ]
}

will replace assets/hello.jpg with images/hello.jpg before validation. It's a standard behavior of JS string.replace method, but for users who don't know that the checker is written in JS and that it uses string.replace, this is a hidden knowledge (I've spent quite some time reading the code and the documentation). Better to document that explicitly (with relevant links) to save the time for future users.

I can create a PR to show the change.

And thanks for a great tool, BTW!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant