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

Description of using URL-encoding for $removeparam rules #605

Merged
merged 7 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/general/ad-filtering/create-own-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -2398,21 +2398,21 @@ You can also use regular expressions to match query parameters and/or their valu

**Escaping special characters**

Special characters should be URL-encoded in a rule to correctly match the URLs text.
Special characters should be URL-encoded in a rule to correctly match the URL text.

E.g. to remove the `?$param=true` you should use the `$removeparam=%24param` rule.
For example, to remove `?$param=true`, you should use the `$removeparam=%24param` rule.

:::note

Space and comma symbols should be URL-encoded as well, otherwise the rule won't match the URL. However, `.`, `-`, `_` and `~` symbols should be used as is because they are not marked as reserved characters in URL-encoding.
Spaces and commas should also be URL-encoded, otherwise the rule won't match the URL. However, `.`, `-`, `_`, and `~` should be used as they are, since they are not marked as reserved characters in URL encoding.

:::

Do not forget to escape special characters like `.` in the regular expressions. Use `\` character for that purpose. For example, an escaped dot should look like this: `\.`.
Remember to escape special characters like `.` in the regular expressions. Use the `\' character to do this. For example, an escaped dot should look like this: `\.`.
anyakushin marked this conversation as resolved.
Show resolved Hide resolved
anyakushin marked this conversation as resolved.
Show resolved Hide resolved

:::note

Regexp-type rules target both name and value of the parameter. To minimize mistakes, it is safer to start every regexp with `/^` unless you specifically target parameter values.
Regexp-type rules apply to both the name and value of the parameter. To minimize errors, it is safer to start each regexp with `/^`, unless you are specifically targeting parameter values.

:::

Expand All @@ -2431,7 +2431,7 @@ Use `~` to apply inversion:

:::note

If `~` appear not at the beginning of the rule it will be treated just as a symbol in the text.
If `~` does not appear at the beginning of the rule, it is treated as a symbol in the text.

:::

Expand Down
Loading