diff --git a/src/Squidex/app/framework/utils/interpolator.spec.ts b/src/Squidex/app/framework/utils/interpolator.spec.ts index 58de0557c..6da899ee1 100644 --- a/src/Squidex/app/framework/utils/interpolator.spec.ts +++ b/src/Squidex/app/framework/utils/interpolator.spec.ts @@ -21,6 +21,12 @@ describe('interpolate', () => { expect(result).toEqual('hello world'); }); + it('should interpolate with multiple object values', () => { + const result = interpolate('hello ${string1}${string2}', { string1: 'world', string2: '!' }); + + expect(result).toEqual('hello world!'); + }); + it('should interpolate with array value', () => { const result = interpolate('hello ${1}', ['my', 'world']); diff --git a/src/Squidex/app/framework/utils/interpolator.ts b/src/Squidex/app/framework/utils/interpolator.ts index 6f3f88e00..5ad5de24e 100644 --- a/src/Squidex/app/framework/utils/interpolator.ts +++ b/src/Squidex/app/framework/utils/interpolator.ts @@ -8,7 +8,7 @@ import { DateTime } from './date-time'; import { Types } from './types'; -const regex = /\${[^}]+}/; +const regex = /\${[^}]+}/g; export function interpolate(pattern: string, value?: any, shortcut?: string, fallback = 'undefined'): string { const result = pattern.replace(regex, (match: string) => {