Fix pattern for RegExp matching

Bug: RegExp pattern didn't match with /.../gi
Fix: Change "(i?g?$)" to "(|i|g|ig|gi)$"
Merge pull request #30 from Xelio/master

Fix pattern for RegExp matching