Commit 379d090e authored by Florent Chehab's avatar Florent Chehab

Modified parseMoney not to parse money in code

parent a35f6215
......@@ -4,7 +4,7 @@
* @returns
*/
function getMoneyRegex() {
return /:(\d*[.,]?\d*)(\w{3}):/g;
return /(?<!`):(\d*[.,]?\d*)(\w{3}):/g;
}
......
......@@ -41,3 +41,11 @@ test("Parse complicated string", () => {
expect(parsed[1].currency).toBe("CHF");
expect(parsed[3].currency).toBe("EUR");
});
test("Money directly in code is returned as text", () => {
const str = "You can use `:120CHF:` to tag money infos",
parsed = parseMoney(str);
expect(parsed.length).toBe(1);
expect(parsed[0].isMoney).toBe(false);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment