Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resolved_username regex #75

Merged
merged 1 commit into from
Jun 8, 2018

Conversation

dhirschfeld
Copy link
Collaborator

@dhirschfeld dhirschfeld commented Jun 8, 2018

The fix in #68 wasn't correct as the regex will swallow the previous character:

>>> re.subn(r"[^\\],", r"\,", "Hirschfeld, David")[0]
'Hirschfel\\, David'

...the workaround is to capture the swallowed character and reinsert it:

>>> re.subn(r"([^\\]),", r"\1\,", "Hirschfeld, David")[0]
'Hirschfeld\\, David'

Not sure if that is the most elegant solution, but it does seem to fix the problem...

@dhirschfeld dhirschfeld merged commit 8220fc6 into jupyterhub:master Jun 8, 2018
@dhirschfeld dhirschfeld deleted the regex-fail branch June 8, 2018 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant