I am writing code:

$content[1] = '1<a href="http://www.site.com/11>11</a>2'; echo preg_replace('/<a href="http://www.site.com(.*?)</a>/', '', $content[1]); 

I get instead of $content[1] = '12'; error:

Warning: preg_replace (): Unknown modifier '/' in /home/gt/site/SUSTEM/PHP_Scripts/PARSER.php on line 50

  • @ Yuri Zav, If you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - Vitalina

2 answers 2

 echo preg_replace('#<a href="http://www.site.com(.*?)</a>#', '', $content[1]); 

You have a slash used both as a descriptor of the regular season and in the regular season itself. Replace it with another handle, for example, with # .

    You have a slash used both as a descriptor of the regular season and in the regular season itself. Replace it with another handle, for example, with #.

    Or use shielding with "\".

     $content[1] = '1<a href="http://www.site.com/11>11</a>2'; echo preg_replace('/<a href="http:\/\/www.site.com(.*?)<\/a>/', '', $content[1]);