JSFiddle - React, Tailwind, and code Playground

by irinablue

JavaScript

const s = '\n 173,39 kr** \n -27% \n                    £ 41,60          \n                        £ 56,99**\n                        -27%\n';
const match = s.match(/[\d,.]+(?!%)/g);
const r = Number.parseFloat(match.toString().replace(/,/g, '.')).toString();

console.log(match);
console.log(match.toString());
console.log(r);
//console.log(r);