Skip to content

Commit

Permalink
[Ruleset Engine] The len() function supports arrays (#19606)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrosousa authored Jan 31, 2025
1 parent e5dcf7a commit fede2d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/content/docs/ruleset-engine/rules-language/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ For example, if `http.request.uri.path` is `"/welcome.html"`, then `ends_with(ht
### `len`

{/* prettier-ignore */}
<code>len(<Type text="String | Bytes" />)</code>: <Type text="Integer" />
<code>len(<Type text="String | Bytes | Array" />)</code>: <Type text="Integer" />

Returns the byte length of a String or Bytes field.
Returns the byte length of a String or Bytes value, or the number of elements in an array.

For example, if `http.host` is `"example.com"`, then `len(http.host)` will return `11`.
For example, if the value of `http.host` is `"example.com"`, then `len(http.host)` will return `11`.

### `lookup_json_integer`

Expand Down Expand Up @@ -348,7 +348,7 @@ url_decode("%2520", "r") will return " "
// Using url_decode() with the any() function:
any(url_decode(http.request.body.form.values[*])[*] contains "an xss attack")
// Using the u option to match a specific alphabet
// Using the u option to match a specific alphabet
url_decode(http.request.uri.path) matches "(?u)\p{Hangul}+"
```

Expand Down

0 comments on commit fede2d0

Please sign in to comment.