Fixed a bug with the `g` flag.

The bug was that after finding a match, the next search in that line
began from right after the *start* of the last match - instead of after
it's end. That means that matching the string 'aa bb' with the pattern
/\w\+/ would yield ['aa','a','bb','b']. After this fix, it yields
['aa','bb'].
Added documentation