There this really useful tool for JS, called RegExpBuilder.
It enables you to build regular expressions with a nice human-readable & chainable syntax.
(read more about it here and here)
As it’s not that much lines of code, I decided to do a port for PHP – et voila:
» read more