proposed fix for issue https://github.com/sensu/sensu/issues/736

It looks like the problem was caused by use of 'inject'. There was also a small tweak needed to the regexp for some cases.

More explanation in the following gists:-

https://gist.github.com/octete/a2a14a74132e9d662060

https://gist.github.com/grahaminn/d593291f24658b955e9b