Ad
  • Default User Avatar

    let match = str.match(new RegExp(town + ':.?(?:\n|$)', 'i'));
    In this line you can replace ':.
    ?(?:\n|$)', 'i' with just '.+'

    But this RegExp (/\d+(.\d+)/g) is really good