I am not very good at regular expressions.
I have various files that have a repeated string inside them:
$find = "><script contentType=\"application/x-javascript\"
>
if(event.target.hostContainer)";
But sometimes instead of the 2
you can see in the above string, there is sometimes 3 or 1. Granted, it's a stupid problem to have to overcome but unfortuantely the file is a pdf... soo i don't have control over its output.
How might i go about searching for the above string while ignoring the
.
The context of my question is:
$file = file_get_contents('pdfs/another1.pdf');
$find = "><script contentType=\"application/x-javascript\"
>
if(event.target.hostContainer)";
$replace = "whatever bla bla";
$output_str = str_replace($find, $replace, $file);