let regex = try! Regex(path: "/v1.0/login", pathOptions: [])
print(regex.pattern)
// Outputs:
// ^\/v1\.0\/login(?:\/(?=$))?
By contrast
var regex = pathToRegexp("/v1.0/login", [], {end: false})
console.log(regex)
// Outputs:
// ^\/v1\.0\/login\/?(?=\/|$)
The Swift version of the regex will match both
which is undesireable.
The JS version will only match
By contrast
The Swift version of the regex will match both
which is undesireable.
The JS version will only match