If a ward is named something like "Trinity-Spadina (19)", then the parentheses must be escaped with a helper like this
The \b metacharacter doesn't match correctly if a district name starts or ends with a parenthesis. Wasn't getting a match until I removed the \\b at the end.
This is very unexpected behaviour, and not inconcievable that someone else could hit it and spend quite a bit of time sorting it out. May I submit a PR to:
Remove the "\b" metacharacters.
Add a utility function to escape the regex.
cc: @jpmckinney, since you'll likely hit the same thing with other Canadian divisions
cc: @derekeder, since git-blame says you have the context :)
Related to this line: https://github.com/datamade/django-councilmatic/blob/master/councilmatic_core/templates/partials/map.html#L140
Couple things that lead to unexpected behaviour:
\b
metacharacter doesn't match correctly if a district name starts or ends with a parenthesis. Wasn't getting a match until I removed the\\b
at the end.This is very unexpected behaviour, and not inconcievable that someone else could hit it and spend quite a bit of time sorting it out. May I submit a PR to:
cc: @jpmckinney, since you'll likely hit the same thing with other Canadian divisions
cc: @derekeder, since
git-blame
says you have the context :)