[eluser]gtech[/eluser]
Hello
try this.. I knicked the regular expression from the router library and adapted it.
Code:
<?php
class Blog extends Controller {
function index()
{
$str = 'Hello World! ** %_ 09 @#@#@#';
$newStr = preg_replace("/[^".preg_quote($this->config->item('permitted_uri_chars'))."]/i",' ', $str);
echo $newStr;
echo "<br>";
echo $str;
}
}
?>
it replaces non permitted chars with a space but you can change it a blank if you want, it seems to work for every example i have chucked at it. The obvious advantage of doing it this way is that it pulls the permitted characters directly from config.
result:
Code:
Hello World %_ 09
Hello World! ** %_ 09 @#@#@#