Skip to content

Commit

Permalink
[fix] branch counting - closes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
asciimoo committed Jul 6, 2016
1 parent 8bc0ddf commit 330a158
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exrex.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _gen(d, limit=20, count=False, grouprefs=None):
elif i[0] == sre_parse.BRANCH:
if count:
for x in i[1][1]:
strings += _gen(x, limit, True,grouprefs)
strings += _gen(x, limit, True,grouprefs) or 1
ret = concit(ret, i[1][1], limit, grouprefs)
elif i[0] == sre_parse.SUBPATTERN:
if count:
Expand Down
2 changes: 2 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
IS_PY3 = version_info[0] == 3

RS = {'[ab][cd]': ['ac', 'ad', 'bc', 'bd']
,'a|ab': ['a', 'ab']
,'(foo|bar)(20|)16': ['foo2016', 'foo16', 'bar2016', 'bar16']
,'[12]{1,2}': ['1', '2', '11', '12', '21', '22']
,'((hai){2}|world)!': ['haihai!', 'world!']
,'[ab]{1,3}': ['a', 'b', 'aa', 'ab', 'ba', 'bb', 'aaa', 'aab', 'aba', 'abb', 'baa', 'bab', 'bba', 'bbb']
Expand Down

0 comments on commit 330a158

Please sign in to comment.