Skip to content

Commit

Permalink
Merge pull request #15 from johnkpaul/fix_issue_14
Browse files Browse the repository at this point in the history
fix issue #14, break out of regex loop if match length is 0
  • Loading branch information
jonmagic committed Apr 12, 2012
2 parents 3d5b74e + 5059204 commit 8dc32ee
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions application.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scripts/application.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class Results
index = execution.index
length = execution[0].length
result.push({index:index,length:length})
break if length+index == 0
value = value.substr(length+index)
result

Expand Down
1 change: 1 addition & 0 deletions spec/ResultsSpec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe 'Results', ->

subjects = [
{'regex': 'a', 'test_strings': [{'string': 'a'}], 'output': '<span>a</span>'}
{'regex': '(issues)?', 'test_strings': [{'string': 'issues'}], 'output': '<span>issues</span>'}
{'regex': 'a$', 'test_strings': [{'string': 'asdfja'}], 'output': 'asdfj<span>a</span>'}
{'regex': '"$', 'test_strings': [{'string': '"hello"'}], 'output': '"hello<span>"</span>'}
{'regex': 'a(.*)c', 'test_strings': [{'string': 'abcdd', 'matches': ['b']}], 'output': '<span>abc</span>dd'}
Expand Down
8 changes: 8 additions & 0 deletions spec/ResultsSpec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8dc32ee

Please sign in to comment.