EasyCatalog panels & data

Using regular expressions (REGEX) with EasyCatalog data cleansing

1075 views June 1, 2018 February 3, 2021 admin 1

Regular expressions provide an extremely flexible and advanced method for cleaning and rearranging source data into a format more suitable for publishing within a catalog.

Regular expression will involve adding or altering the start or end of a field, replacing or reformatting specific values or targeting one or more parts of a field. Regular expressions can be very handy when a field needs to be reformatted, creating an inline heading in bold, or adding/tidying bullets.

Regular expressions used within EasyCatalog are very similar to regular expressions used within other operating systems / programming languages (e.g. Python, Perl, C++, PHP).

A notable exception is that InDesign uses the ^ character as a signifier for its own extended characters (e.g. ^p = paragraph; ^t = tab). To target the start of a string you need to use two carets, i.e. ^^.

Common regular expressions

Common regular expressions target the start or end of a field, or replace or reformat part of the field.

Details Syntax Description
^^ Find at start of field REGEX:^^Apple=Banana; Replaces Apple at start of field with Banana
$ Find at end of field REGEX:apple.$=banana.; Replaces apple. at end of field with banana.
[abc] A single character REGEX:[c]=C; Replaces cat with Cat.
[^abc] A character except REGEX:[^c]=x; Replaces cat with cxx.
. Any single character REGEX:.=grape;
^x$ Find whole field REGEX:^^0.00$; Replaces 0.00 with nothing (Values such as 10.00, 12.34 will remain untouched)
/1 Find first part of field

Complex regular expression samples

Advanced regular expression statements and operations containing multiple expressions may be used to dramatically transform underlying data.

 

Regular expression(s) Details Syntax Description
^^
$
Find at start of field
Find at end of field
REGEX:^^=<sup>$</sup>;
.=<sup>;
REGEX:$=</sup>;
Adds superscript “$” to start of field, removes “.” and converts cents to superscript, e.g. 12.34 changes to  $1234.

Regular expression builder

Web-based regular expression builders provides valuable insights into targeting regular expressions for parts of your chosen string, for example:

Was this helpful?