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

Add an option to regex.escape() to not escape spaces #249

Closed
mrabarnett opened this issue Jun 20, 2017 · 1 comment
Closed

Add an option to regex.escape() to not escape spaces #249

mrabarnett opened this issue Jun 20, 2017 · 1 comment
Labels
bug Something isn't working major

Comments

@mrabarnett
Copy link
Owner

Original report by kovidgoyal (Bitbucket: kovidgoyal, GitHub: kovidgoyal).


Recently, regex.escape() was changed to also escape spaces, because spaces are significant in VERBOSE patterns. However, escaping spaces is ugly when the escaped string is presented to a user for editing. Could you add another keyword argument to escape() to not escape spaces. So if the caller of escape() knows that the pattern is not going to be used with the VERBOSE flag, they can chosoe not to escape spaces.

@mrabarnett
Copy link
Owner Author

Original comment by Matthew Barnett (Bitbucket: mrabarnett, GitHub: mrabarnett).


Added literal_spaces keyword (default False) to regex.escape function in regex 2017.06.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant