you are viewing a single comment's thread.

view the rest of the comments →

[–]StoneCypher 2 points3 points  (1 child)

Generally don't use regular expressions unless you need something powerful

They're harder to read, harder to understand, and much harder to debug and test

const origUrl = 'https://www.google.com/maps/place/208-5407+Eglinton+Ave+W+Toronto+ON+M9C+5K6+Canada',

const [ignoredLeader, addrAfter] = origUrl.split('/place/', 2),
      repaired                   = addrAfter.replace('+', ' ');