Link to home
Create AccountLog in
Avatar of willsherwood
willsherwood

asked on

PHP preg_replace - how to make this match string span across lines?

I have the following PHP statement:
preg_replace("/%BEGINt%.*%END%/", '', $Content);

that is supposed to yield a result that omits  %BEGIN% MyInnerText %END%     from $Content

it works as long as $Content doesn't have any linebreaks within in the corresponding MyInnerText.

How can i get this search string to be line-break-insensitive?
Note that i do not want linebreaks deleted in general from $Content

thanks
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of willsherwood
willsherwood

ASKER

$Content = file_get_contents($FileLocation);  
is the statement used to read the file

thanks to all!