updated regex, fixed issues with prior implementation

This should resolve the issues found before.