How can I repalce the closing bracket ‘)’ in a certain string with ‘space’ in replace function?
Could you provide some examples of certain string?
samliew – request private consultation
Join the Make Fans Discord server to chat with other makers!
1 Like
Say for example:
+1 (992) 602-8414
I want to replace this ‘)’ with a space.
I’m able to replace all other characters like +, (, - but not the ).
i want to use the replace function to do this.
You can use the built-in function replace
e.g.:
{{ replace(1.text; "/[+\s\(\)-]/g"; emptystring) }}
For more information, see the function documentation in the Help Center.
The pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.
- The complete list of metacharacters can be found on the MDN web docs website.
- For a tutorial on how to create regular expressions, we recommend the RegexOne website.
- For an easy, quick regex generator, try the Regular Expressions generator.
- For experimenting with regular expressions, we recommend the regular expressions 101 website. Just make sure to tick the ECMAScript (JavaScript) FLAVOR in the left panel.
Hope this helps!
2 Likes