diff --git a/__tests__/index.test.jsx b/__tests__/index.test.jsx index fa48300..81f4017 100644 --- a/__tests__/index.test.jsx +++ b/__tests__/index.test.jsx @@ -224,4 +224,10 @@ describe('VARIABLE_REGEXP', () => { it('should match against colons with non-english characters', () => { expect('<>').toMatch(new RegExp(VARIABLE_REGEXP)); }); + + it('should NOT match against newlines', () => { + expect('<>').not.toMatch(new RegExp(VARIABLE_REGEXP)); + expect('<>').not.toMatch(new RegExp(VARIABLE_REGEXP)); + expect('<>').not.toMatch(new RegExp(VARIABLE_REGEXP)); + }); }); diff --git a/index.jsx b/index.jsx index 4d748c9..efe490e 100644 --- a/index.jsx +++ b/index.jsx @@ -185,6 +185,6 @@ module.exports.Variable = Variable; // - \<> - escaped variables // - <> - regular variables // - <> - glossary -module.exports.VARIABLE_REGEXP = /(?:\\)?<<([-_\p{L}:.\s\d]+)(?:\\)?>>/iu.source; +module.exports.VARIABLE_REGEXP = /(?:\\)?<<((?:(?![\r\n])[-_\p{L}:.\s\d])+)(?:\\)?>>/iu.source; module.exports.VariablesContext = VariablesContext; module.exports.SelectedAppContext = SelectedAppContext;