How to replace text over multiple lines using preg_replace

Glisselub

New Member
Hi have the following content within an html page that stretches multiple lines\[code\]<div class="c-fc c-bc" id="content"> <span class="content-heading c-hc">Heading 1 </span><br /> The Home Page must provide a introduction to the services provided.<br /> <br /> <span class="c-sc">Sub Heading</span><br /> The Home Page must provide a introduction to the services provided.<br /> <br /> <span class="c-sc">Sub Heading</span><br /> The Home Page must provide a introduction to the services provided.<br /> </div>\[/code\]I need to replace everthing between \[code\]<div class="c-fc c-bc" id="content">\[/code\] and \[code\]</div>\[/code\] with custom textI use the following code to accomplish this but it does not want to work if it's multiple lines, but works if evertinh is in one line\[code\]$body = file_get_contents('../../templates/'.$val['url']);$body = preg_replace('/<div class=\"c\-fc c\-bc\" id=\"content\">(.*)<\/div>/','<div class="c-fc c-bc" id="content">abc</div>',$body);\[/code\]Am I missing something?
 
Back
Top