Skip to content

Commit

Permalink
Support for replace with regexp
Browse files Browse the repository at this point in the history
This PR addresses issues schibsted#346 and schibsted#347.
Added documentation.
  • Loading branch information
Carlo Dapor committed May 26, 2024
1 parent 1eebe41 commit d84fa16
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,12 @@ If the `regexp` does not match the input,`out` corresponds to `value`.
Examples:

```
replace-regexp("2019-12-31", "([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])", "$2/$3/$1") => "12/31/2019"
replace-regexp("2019-12-31", "(?<year>[0-9][0-9][0-9][0-9])-(?<month>[0-9][0-9])-(?<day>[0-9][0-9])", "$3.$2.$1") => "31.12.2019"
replace-regexp("2019-12-31", "([a-z]+)", "$1") => "2019-12-31"
replace-regexp("2019-12-31", "([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])", "$2/$3/$1")
=> "12/31/2019"
replace-regexp("2019-12-31", "(?<year>[0-9][0-9][0-9][0-9])-(?<month>[0-9][0-9])-(?<day>[0-9][0-9])",
=> "${day}.${month}.${year}") => "31.12.2019"
replace-regexp("2019-12-31", "([a-z]+)", "$1")
=> "2019-12-31"
```

### _trim(string) -> string_
Expand Down

0 comments on commit d84fa16

Please sign in to comment.