I'm working on a regex but don't know exactly what to do further. These are my regex:
In price.ts
if (isTaiwan(locale)) {
return price.replace(/\s(\d)/g, '$1,$2').replace('', '.');
}
these regex check either for currency String or numbers. Example to each one
- NT$ 74,000.00
I have a test with Jest
in price.test.ts
it('should format tw prices correctly', () => {
expect(
formatPrice('zh_tw', {
currency: Currencies.TW,
value: 74000.0,
}),
).toEqual('NT\u0024\u002074,000.00');
});
But I don't get the result I want
Expected: "NT$ 74,000.00"
Received: "NT$74.000.00"
I would like a space between the $ and the digits