Use a tighter regex pattern to avoid conflicts with RequireJS

Fixes #6. 

This required changing the way the matches are handled slightly, but I actually think it's better to have the tighter matching pattern. Thoughts?