EasyCatalog panels & data

Using regular expressions (REGEX) with EasyCatalog data cleansing

707 views June 1, 2018 March 11, 2020 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 catalogue.

Common regular expressions

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. ^^.

Regular expression 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:[abc]=x;
[^abc] A character except REGEX:[^abc]=x;
. 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)
^^
n/a
$
Find at start of field
Non REGEX cleansing
Find at end of field
REGEX:^^=<sup>$</sup>;
.=<sup>;
REGEX:$=</sup>;
Adds superscript $ to start of field and converts cents to superscript, e.g. $1234

Regular expression builder

The txt2re regular expression builder provides valuable insights into targeting regular expressions for parts of your chosen string.

Was this helpful?