Apply Regular Expression
Last updated
Last updated
This action applies regular expression. Enter regex inside slashes (/example/). Use /g at the end for all occurrences (/example/g).
This method searches for a match and replaces its first occurrence with the entered replacement value.
To replace all occurrences, use /g (/example/g).
Note: The value that you want to replace is correctly entered inside two slashes. The letter 'g' after the closing slash means that all occurrences should be replaced.
Value to replace with is left empty because we want to replace commas with nothing.
This method searches for a match and updates the value with the first found match.
Example: Imagine you want to get ids from a list of Google Sheet links. This regex /\/([\w-_]{15,})\/(.*?gid=(\d+))?/
will search for a Google Sheet id inside a Google Sheets link.
Assume this value is currently in the column:
This is the needed set-up:
This is the result:
You can add any flag after the slash. While /g is the most common one (and stands for all occurrences), there are other flags such as /i (case insensitive match) or /m (multi line match). You can also combine multiple flags together (/example/gi).
Absolutely! Regex is simply a sequence of characters that specifies a match pattern in text. Anyone can use it. There are many reference guides on the internet to learn more. Here is one example: Regex reference guide.
Here is one of the many publicly available resources where you can validate your regular expression: https://regex101.com/ (enter your regular expression into the field above and the text that you want to test it against into the field below).