Skip to main content

Getting Started With Regular Expressions

In Import.io, you can uses Set Regular Expression to find text that matches a pattern, then replace the matched strings with other strings.

Import.io supports standard regular expression syntax. You can refer to any number of excellent online regular expression tutorials to learn more about the syntax. Import.io uses native JavaScript regular expression functions, which do not support some regular expression functions such as lookbehind.

The following examples demonstrate possible ways to use regular expressions.

Example 1: Match and remove part of a text string

This example demonstrates how to use Set regular expression to match on a certain string, such as the "Accepts Android Pay" and match the following "Yes" or "No". To remove the string, perform the following steps:

  • Identify the common text string you wish to remove, in this example, "Accepts Google Pay"
  • Click the Column Options dropdown arrow and select Set regular expression. The Set regular expression dialog box appears.
  • In the Match box, enter "Accepts Google Pay\s+(.+)" to identify the Accepts Google Pay string and then capture the remainder of the string in the first capture capture group.
  • In the Replace box, enter $1 to print out the first capture group. The prefix disappears from the column data, leaving the remainder of the string intact.

Example 2: Transforming strings

This example demonstrates how to use Set Regular Expression to re-format a price that is missing a period in-between the dollars and cents amounts. To transform the string, perform the following steps:

  • Identify the common text substrings you wish to transform, in this example, price block.
  • Click the Column Options dropdown arrow and select Set regular expression. The Set regular expression dialog box appears.
  • In the Match box, enter "([^$]+)\d2$" to start from the end of the string, create a capture group around the first two digits and then a capture group around the rest of the string up to the dollar sign.
  • In the Replace box, enter "$$$1.$2". $$ represents the dollar sign since $ is used to denote a capture group. $1 references the item inside first set of parentheses in the match expression and $2 references the item inside the second set of parentheses, transforming the data from "$2433" to "$24.33".