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

Sort word lists rule #214

Closed
RunDevelopment opened this issue May 27, 2021 · 0 comments · Fixed by #235
Closed

Sort word lists rule #214

RunDevelopment opened this issue May 27, 2021 · 0 comments · Fixed by #235
Assignees
Labels

Comments

@RunDevelopment
Copy link
Collaborator

Some regexes contain (potentially long) lists of words. E.g. almost every language over at Prism has at least one regex like this.

For many of those lists, the order of alternatives doesn't matter. I.e. most word lists in Prism are surrounded with \bs. In this case, we are free to reorder (=sort) the alternatives.

Sorting these lists is beneficial because it makes it easier for humans to find words. This makes it easier to maintain the regexes containing these lists.

Another additional advantage is that compression algorithms (e.g. gzip) are typically able to better compress sorted lists. I tested this with a few examples and sorted lists were around 10% smaller when compressed with gzip.


This rule is basically order-in-character-class but for groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant