Delete text between and including identifying strings
Internet answered this question for Agaric, and we'll make it easier for the next person to find the answer!
remove HTML within markers
regexp strip all between two snippets
regexp delete between two keywords
php delete between strings
There's a great, informative post – just in response to a question on a forum – on how to do it with a regular expression here:
http://www.programmingtalk.com/showthread.php?threadid=39966
With this answer:
$string = preg_replace( '/\<body\>.*\<table/Usi', '<body><table', $string );
Our modification (main difference, not re-adding the search strings) worked quite nicely to remove unwanted text hardcoded into another Drupal module, the otherwise wonderful Video module in 4.7:
// dirty, dirty hack to get around video 4.7 not allowing any way to
// remove the 'Problems viewing' text without redoing the whole output
$vid = preg_replace( '/\<p\>\nProblems viewing.*\n\<\/p\>/Usi', '', $vid );
Internet answered this question for Agaric, and we'll make it easier for the next person to find the answer!
remove HTML within markers
regexp strip all between two snippets
regexp delete between two keywords
php delete between strings
There's a great, informative post – just in response to a question on a forum – on how to do it with a regular expression here:
http://www.programmingtalk.com/showthread.php?threadid=39966
With this answer:
$string = preg_replace( '/\<body\>.*\<table/Usi', '<body><table', $string );
Our modification (main difference, not re-adding the search strings) worked quite nicely to remove unwanted text hardcoded into another Drupal module, the otherwise wonderful Video module in 4.7:
// dirty, dirty hack to get around video 4.7 not allowing any way to
// remove the 'Problems viewing' text without redoing the whole output
$vid = preg_replace( '/\<p\>\nProblems viewing.*\n\<\/p\>/Usi', '', $vid );
Comments
Post new comment