Pages
core
Search
Entities
Regexp
Functions
Creates a new regular expression from a string.
(Regexp.create("test")
|> Regexp.toString()) == "/test/"
Creates a new regular expression using the given options.
(Regexp.createWithOptions(
"test",
{
caseInsensitive = true,
multiline = true,
unicode = true,
global = true,
sticky = true
})
|> Regexp.toString()) == "/test/gimuy"
Escapes the given input to use in the regular expression.
Regexp.escape("-{") == "\\-\\{"
Returns whether or not the given regular expression matches the given string.
(Regexp.create(",")
|> Regexp.match("asd,asd")) == true
Returns all of the matches of the given regular expression against the given string.
(Regexp.createWithOptions(
"\\w",
{
caseInsensitive = true,
multiline = false,
unicode = false,
global = true,
sticky = false
})
|> Regexp.matces("a,b,c,d") == [
{
submatches = [],
match = "a",
index = 0
}
]
\match : Regexp.Match => match.match + "1")) == "a1,b1,c1,d1"
Replaces the matches of the given regular expression using the given function to calculate the replacement string.
(Regexp.createWithOptions(
"\\w",
{
caseInsensitive = true,
multiline = false,
unicode = false,
global = true,
sticky = false
})
|> Regexp.replace(
"a,b,c,d",
\match : Regexp.Match => match.match + "1")) == "a1,b1,c1,d1"
Splits the given string by the given regular expression.
(Regexp.create(",")
|> Regexp.split("a,b,c,d")) == ["a", "b", "c", "d"]
Returns the string representation of the given regular expression.
(Regexp.create("test")
|> Regexp.toString()) == "/test/"