Using special, regular expression characters in regular expressions require you to escape them in the regular expression pattern. I had an issue with dynamically getting an array of URLs from HREF attribute from links using PHP preg_match_all and then wanted to replace this array of URLs dynamically in a loop again with their links