This code worked for a couple of weeks, returning an error now. Any suggestions on what migth have happened? It seems the site I'm parsing made minor changes causing my parser to choke on it ...
Imagine the following string in file test.html
(without dots)
... </script> <script type="text/javascript" src=" ...
Desired string transformation
Replace <script type="text/javascript" with <tagkilled
With the following php code
$file = "test.html";
// Destroy javascript codetag
$command='/bin/sed -ri \'s/<script type="text\/javascript"/<tagkilled/g\' '.str_replace(' ','\ ',$file);
exec($command);
Returned error message
/bin/sed: -e expression #1, char 34: Invalid preceding regular expression
Sidenotes: Running sed 4.2.1 Dec. 2010 on Ubuntu 12.10.