When attempting to match routes with embedded variables all occurrences in the potentially matched route of the same string as the value of a variable were being replaced since a regex based string replace method was being used. Refactored to actually replace the correct index of the compared route followed by rejoining it into its string form for comparison. This ensures no collisions between variable values and similar substrings in the route.