Documentation

Fixes #13 

- Added documentation
- Updated code to use ".lastindex" instead of ".lastIndex"