Skip to content

Commit f3f7931

Browse files
authored
replace lookbehind regex (closes #69)
1 parent 4501c13 commit f3f7931

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/pocompiler.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,13 @@ Compiler.prototype._addPOString = function (key = '', value = '', obsolete = fal
182182
} else {
183183
// split only on new lines
184184
if (escapeCharacters) {
185-
lines = value.split(/(?<=\\n)/);
185+
lines = value.split(/\\n/g);
186+
for (let i = 0; i < lines.length - 1; i++) {
187+
lines[i] = `${lines[i]}\\n`;
188+
}
189+
if (lines.length && lines[lines.length - 1] === '') {
190+
lines.splice(-1, 1);
191+
}
186192
}
187193
}
188194

0 commit comments

Comments
 (0)