Updated .gitignore to ignore IntelliJ IDEA files.
Optimised regexp matching and added trimming to fix #3
Added tests.
Updated gradle ignores in .gitignore
Version 1.0.2 with bug fixes and speed improvements.