I'm trying to use the preg_replace to find greater than and less than symbols that aren't part of an html tag. This works in dreamweaver when I tested it but on my page it doesn't work any ideas? Thanks.
PHP Code://Find less than and greater thans that arent part of an html tag
$patterns[] = '/[^ol,li,p,ul,img,/p,/ol,/li,/ul,em,/em,strong,/strong,br,table,tbody,tr,td,/table,/td,/tbody,/tr,sup,sub,/sup,/sub,a,/a,class=",start="]>/i';
$replacements[] = '>';
$patterns[] = '/<[^ol,li,p,ul,img,/p,/ol,/li,/ul,em,/em,strong,/strong,br,table,tbody,tr,td,/table,/td,/tbody,/tr,sup,sub,/sup,/sub,a,/a]/i';
$replacements[] = '<';
$contents = preg_replace($patterns, $replacements, $input);
echo htmlspecialchars($contents);
The line 182 is the contents= preg_replace line, there are multiple things I'm swapping this is the only one that causes the errors though. When I say this works in dreamweaver I mean if I put theWarning: preg_replace() [function.preg-replace]: Unknown modifier 'p' in /home/bluewalr/public_html/christophermacdonald.net/protocol.php on line 182in for the search value it will find the less than symbol.<[^ol,li,p,ul,img,/p,/ol,/li,/ul,em,/em,strong,/strong,br,table,tbody,tr,td,/table,/td,/tbody,/tr,sup,sub,/sup,/sub,a,/a]



Reply With Quote

Bookmarks