0

The below function is showing error in the

"'<script[^>]*?>.*? </script>'si", // Strip out javascript

line. How I can remove ??

function smfeed_html_to_text($string){

	$search = array (
		"'<script[^>]*?>.*? </script>'si",  // Strip out javascript
		"'<[\/\!]*?[^<>]*?>'si",  // Strip out html tags
		"'([\r\n])[\s]+'",  // Strip out white space
		"'&(quot|#34);'i",  // Replace html entities
		"'&(amp|#38);'i",
		"'&(lt|#60);'i",
		"'&(gt|#62);'i",
		"'&(nbsp|#160);'i",
		"'&(iexcl|#161);'i",
		"'&(cent|#162);'i",
		"'&(pound|#163);'i",
		"'&(copy|#169);'i",
		"'&(reg|#174);'i",
		"'™'i",
		"'•'i",
		"'—'i",
		"'&#(\d+);'e"
		);  // evaluate as php
	
	$replace = array (
		" ",
		" ",
		"\\1",
		"\"",
		"&",
		"<",
		">",
		" ",
		"&iexcl;",
		"&cent;",
		"&pound;",
		"&copy;",
		"&reg;",
		"<sup><small>TM</small></sup>",
		"&bull;",
		"-",
		"uchr(\\1)"
		);
	
	$text = preg_replace ($search, $replace, $string);
	return $text;	
}

Edited by abhi10kumar: not accurate

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by abhi10kumar
0
$search = array ("'<script[^>]*?>.*?</script>'si",

I am not sure if this may be your issue, but you have white space between *? and </script> that may be the reason for the error? Above is the line without the space.

Edited by Kraai: n/a

0

Code is showing in the design view.
From .*? </script>'si", line all code is viewing.
You can see by coping entire code in IDE.

$search = array ("'<script[^>]*?>.*?</script>'si",

I am not sure if this may be your issue, but you have white space between *? and </script> that may be the reason for the error? Above is the line without the space.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.