Skip to content

Commit

Permalink
Update doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Sep 13, 2022
1 parent 7a673a6 commit 484c3c1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion doc/content/language.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,22 @@ Regular expression flags are:
Regular expressions have the following methods:

* `replace(fn, s)`: replace matched substrings of `s` using function `fn`. If the `g` flag is not passed, only the first match is replaced otherwise, all matches are replaced
* `exec(s)`: execute the regular expression and return a list matches of the form: `[(<match index>, <match>), ..]`
* `split(s)`: split the given string on all substrings matching the regular expression.
* `test(s)`: returns `true` if the given string matches the regular expression.
* `exec(s)`: execute the regular expression and return a of list matches of the form: `[(<match index>, <match>), ..]`. Named matches are also supported and returned as property `groups` of type `[string * string]`:
```liquidsoap
r/(foo)(?<gno>gni)?/g.exec("foogni")
- : [int * string].{groups : [string * string]} =
[
(2, "gni"),
(1, "foo"),
(0, "foogni")
].{
groups = [
("gno", "gni")
]
}
```

### Booleans

Expand Down

0 comments on commit 484c3c1

Please sign in to comment.