diff options
Diffstat (limited to 'src/gleam_stdlib.mjs')
-rw-r--r-- | src/gleam_stdlib.mjs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs index 40fcc3f..d921c63 100644 --- a/src/gleam_stdlib.mjs +++ b/src/gleam_stdlib.mjs @@ -402,6 +402,10 @@ export function compile_regex(pattern, options) { } } +export function regex_split(regex, string) { + return List.fromArray(string.split(regex).map(item => item === undefined ? "" : item)); +} + export function regex_scan(regex, string) { const matches = Array.from(string.matchAll(regex)).map((match) => { const content = match[0]; |