Skip to content

Commit 29e13a7

Browse files
authored
[Ruleset Engine, Rules] Clarify function usage (cloudflare#25050)
1 parent e4a88b2 commit 29e13a7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/content/docs/rules/transform/url-rewrite/reference/fields-functions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ A rewrite expression (that is, the expression that defines the dynamic URL rewri
2828

2929
Refer to the [Fields reference](/ruleset-engine/rules-language/fields/reference/) for more information on these fields.
3030

31-
The [`concat()`](/ruleset-engine/rules-language/functions/#concat), [`regex_replace()`](/ruleset-engine/rules-language/functions/#regex_replace), and [`wildcard_replace()`](/ruleset-engine/rules-language/functions/#wildcard_replace) functions can appear only **once** in a rewrite expression.
31+
The [`concat()`](/ruleset-engine/rules-language/functions/#concat), [`regex_replace()`](/ruleset-engine/rules-language/functions/#regex_replace), and [`wildcard_replace()`](/ruleset-engine/rules-language/functions/#wildcard_replace) functions can appear only once in a rewrite expression. Additionally, you cannot nest the `regex_replace()` and `wildcard_replace()` functions.

src/content/docs/ruleset-engine/rules-language/functions.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,10 @@ Examples:
249249

250250
Create capture groups by putting part of the regular expression in parentheses. Then, reference a capture group using `${<NUMBER>}` in the replacement string, where `<NUMBER>` is the number of the capture group.
251251

252+
You can only use the `regex_replace()` function once in an expression, and you cannot nest it with the [`wildcard_replace()`](/ruleset-engine/rules-language/functions/#wildcard_replace) function.
253+
252254
:::note
253-
You can only use the `regex_replace()` function in rewrite expressions of [Transform Rules](/rules/transform/) and target URL expressions of [dynamic URL redirects](/rules/url-forwarding/single-redirects/).
255+
Currently, the `regex_replace()` function is only available in rewrite expressions of [Transform Rules](/rules/transform/) and target URL expressions of [dynamic URL redirects](/rules/url-forwarding/single-redirects/).
254256
:::
255257

256258
### `remove_bytes`
@@ -423,6 +425,8 @@ To perform case-sensitive wildcard matching, set the `flags` parameter to `"s"`.
423425

424426
This function uses lazy matching, that is, it tries to match each `*` metacharacter with the shortest possible string.
425427

428+
You can only use the `wildcard_replace()` function once in an expression, and you cannot nest it with the [`regex_replace()`](/ruleset-engine/rules-language/functions/#regex_replace) function.
429+
426430
Examples:
427431

428432
- If the full URI is `https://apps.example.com/calendar/admin?expand=true`,<br/>

0 commit comments

Comments
 (0)