Help Center

Regular expression find and replace

Last Updated: Jan 16, 2017 10:05AM PST

Set regular expression


You can use regular expression to modify column results. For example, you may want to:
 
  • create a regular expression to remove unwanted prefixes, e.g. "Phone: ", "Price - " from the results
  • use the Output HTML feature to get the raw HTML for the selected element and create a regular expression to extract the exact data that you want

Standard regular expression syntax is supported. There are a number of excellent online regular expression tutorials that you can follow to learn more about the syntax. Since Import.io Extractor uses native JavaScript regular expression functions, some regular expression features such as lookbehind are not supported. Check out this article for more details.


Example 1

In the following example, you can see how to use the Set regular expression option to remove the "Mfr#: " prefix from the Manufacturer number values:





Here, the expression

Mfr#: (.+)

matches strings containing any characters preceded by "Mfr#: ". Inside Replace, $1 references the item inside the brackets (in the Match expression) and replaces the original column values with the actual manufacturer numbers.


Example 2

In the next example, you can see how to easily transform "£x-y" to "from x to y GBP":





Here, the expression

£([0-9]*)-([0-9]*)

matches two numerical strings separated by "-". Inside 
Replace, $1 references the item inside the 1st set of brackets (in the Match expression), while $2 references that inside the 2nd set of brackets.
c2d12fc2f876f019701e1c3951e354bd@importio.desk-mail.com
http://assets2.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete