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

Tests: Added new pattern check for octal escapes #2189

Merged

Conversation

RunDevelopment
Copy link
Member

This adds a new pattern check to disallow octal character escapes (e.g. \12). Octal escapes are not allowed in Unicode mode and for good reasons. They look like back-references and are a potential cause for problems because of it. E.g. \2 can back-reference or the octal escape for \x02 depending on how many capturing groups the pattern has. This is a problem when (re-)writing patterns as removing a capturing group can break the back-reference but will still result in a valid regex.

I even found a pattern with this problem. My own.
In #1892, I copied the here-doc string pattern from bash and probably removed a capturing group after verifying that everything works breaking my pattern.
This problem is no more and I also remove an unnecessary non-capturing group in bash.

@RunDevelopment RunDevelopment merged commit 81e1c3d into PrismJS:master Jan 18, 2020
@RunDevelopment RunDevelopment deleted the octal-escape-pattern-check branch January 18, 2020 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants