function parseWithLocale(value, options) {
  const separator = getDecimalSeparator(options?.locale, options);
  const regexNumberAndLocaleSeparator = new RegExp(`[0-9${separator}-]`, 'g');
  let numberAndLocaleSeparator = value.match(regexNumberAndLocaleSeparator)?.join('');
  if (separator === ',') {
    numberAndLocaleSeparator = numberAndLocaleSeparator?.replace(',', '.');
  }
  if (!numberAndLocaleSeparator) {
    return NaN;
  }
  return parseFloat(numberAndLocaleSeparator);
}
Parses numbers by considering the locale.
Useful for numbers with an ending pair of 3 number chars as in this case you can not be
certain if it is a group or comma separator. e.g. 1.234; 1,234; 1234.567;
Taking into consideration the locale we make the best possible assumption.

@example
parseWithLocale('1.234', { locale: 'en-GB' }) => 1.234
parseWithLocale('1,234', { locale: 'en-GB' }) => 1234

@param {string} value Number to be parsed
@param {import('../../types/LocalizeMixinTypes.js').FormatNumberOptions} options Locale Options