Skip to content

Commit

Permalink
Invert now pulls from a common word list, instead of all words
Browse files Browse the repository at this point in the history
  • Loading branch information
smartycope committed Apr 18, 2024
1 parent ee445b9 commit a548adb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions ezregex/assets/common_sorted_words.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ezregex/invert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if __name__ != '__main__':
from .invert_old import invertRegex

with open(Path(__file__).parent / 'assets' / 'sorted_words.json') as f:
with open(Path(__file__).parent / 'assets' / 'common_sorted_words.json') as f:
words = json.load(f)

# Don't use string.whitespace, because we don't want to use weird difficult to print characters.
Expand Down
12 changes: 11 additions & 1 deletion tests/data/regexs.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,16 @@
[],
[]
],
[
"group('pattern', name='i') + optional(digit) + match_max(group('me')) + amt(2, 'mhmm')",
[],
[]
],
[
"group('', name='i') + optional(digit) + match_max(group('')) + amt(2, '')",
[],
[]
],
// ('foo' + ((chunk + 'here' + chunk) & (chunk + anyOf('this', 'that') + chunk)) + 'bar', ('fooum here there that bar', 'foo that there here bar'), None),
// ('foo' + ((chunk + 'here' + chunk) & (chunk + anyOf('this', 'that') + chunk) & (chunk + 'the' + chunk)) + 'bar', ('fooum the here there that bar', 'foo that there thehere bar'), ('fooum here there that bar', 'foo that there here bar')),
// (, (,), (,)),
Expand Down Expand Up @@ -627,5 +637,5 @@
"'------------------LAST REGEX---------------------'",
["------------------LAST REGEX---------------------"],
["asdk"]
],
]
]

0 comments on commit a548adb

Please sign in to comment.