jonmagic/scriptular — pull request #13 by johnkpaul (2012-03-30 23:47:46+00:00)
Title: change match generation algo for display. fixes issue #11

Because, at least in my opinion, the javascript implementation of match and search are really odd, the only way that I could find to get both the match and it's exact location in the string, is by using this algorithm. It can be seen in lines 100-109 of application.coffee in my new commit.

The indexOf method, that was used originally, breaks in two additional test cases that I added. This is because indexOf can't take into account where exactly the match was found in the test string.