I tried using preg_replace method to replace matching regular expression but i am getting the error message
“Warning: preg_replace(): No ending delimiter ‘_’ found”
$oldString = "";
$newString = preg_replace("/[^a-z0-9_]/ig", "", $oldString);
Here i am trying to remove all the characters other than alphabets,numbers and underscore.
The
gis not supported in PHP, remove thegmodifier (global) will do.Here is the list of supported modifier