I have to remove :
from the string colon
for example $chapter=Area of shape:triangle
I have already tried preg_replace('[^a-zA-Z0-9]',$chapter);
I have to remove :
from the string colon
for example $chapter=Area of shape:triangle
I have already tried preg_replace('[^a-zA-Z0-9]',$chapter);
You forgot delimiters and the second parameter of preg_replace function.
preg_replace('~[^a-zA-Z0-9]+~', '', $chapter);
Maybe I don't understand the question or I over-simplify it, but ain't it just:
str_replace(":", "", $chapter);
? This would return $chapter with all colons removed.