If you want to create small snippets of PHP to fix annoying WordPress code habits – you can do it using the PHP function preg_replace and some regular expressions.
If you are like me, you are about to just roll your eyes and move onto something else. I can’t do regular expressions for a toffee.
But here are two websites that make this all possible.
Practice Your Regular Expression
Use this one to practice your regular expressions until you get them right. http://regexr.com/
And use this one to make sure your preg_replace will work. http://infoheap.com/php-preg_replace-back-reference-within-pattern/