Check out v4 of the Fauna CLI
v4 of the Fauna CLI is now in beta. The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start. |
string.replaceRegex()
Replace occurrences of a String matching a regex.
Signature
replaceRegex(match: String, replacement: String) => String
replaceRegex(match: String, replacement: String, count: Number) => String
Description
The replaceRegex()
method replaces count number of occurrences of
the a string that evaluates to the match regex with the replacement
string.
The original string isn’t changed.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
match |
Yes |
Regex to compare against source string for matching string. Supports Java regex. |
|
replacement |
Yes |
String to replace matching string in source string. |
|
count |
Count of number of matching occurrences to replace. |
Return value
Type | Description |
---|---|
Original string with substrings that match the match regex replaced by the replacement string. |
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!