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

Use POSIX bracket expressions in raw regex literals #31

Open
Forthoney opened this issue Apr 5, 2024 · 1 comment
Open

Use POSIX bracket expressions in raw regex literals #31

Forthoney opened this issue Apr 5, 2024 · 1 comment

Comments

@Forthoney
Copy link

We should consider using POSIX bracket expressions instead of raw regex patterns where applicable since POSIX bracket expressions better express the intention of a regex pattern.
Take FIELD_VALUE = /[^\000-\037]*/ in connection.rb for example. Expressing /[^\000-\037]*/ as [[:print:]]* does a better job of expressing that a field value must be a printable value.

@ioquatix
Copy link
Member

ioquatix commented Apr 5, 2024

I'm open to improvements, but IIRC the reason why I did this was to replicate exactly what was in the RFC. In theory, it's easy to see that the definition in this code matches the RFC just by visual comparison.

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

No branches or pull requests

2 participants