Replaced the regExp and added a foreach loop. Removed style

https://github.com/GigaOM/gigaom/issues/5083

I tested it using the examples here https://github.com/GigaOM/gigaom/issues/4979 
they all looked good
See XXX regarding use of `__return_true` here.