diff --git a/packages/decap-cms-lib-widgets/src/stringTemplate.ts b/packages/decap-cms-lib-widgets/src/stringTemplate.ts index 1675756f1db0..15184d4f58d6 100644 --- a/packages/decap-cms-lib-widgets/src/stringTemplate.ts +++ b/packages/decap-cms-lib-widgets/src/stringTemplate.ts @@ -36,8 +36,8 @@ const filters = [ ]; const FIELD_PREFIX = 'fields.'; -const templateContentPattern = '([^}{|]+)'; -const filterPattern = '( \\| ([^}{]+))?'; +const templateContentPattern = ' *([^}{| ]+)'; +const filterPattern = '( \\| ([^}{]+?))? *'; const templateVariablePattern = `{{${templateContentPattern}${filterPattern}}}`; // prepends a Zero if the date has only 1 digit