I was working on the application and came accross a situation where I need to replace all character except the numeric ones. My text pattern was something similar to varchar(20). I initial thought to use substr, later moved to explode using “(” token. I suddenly strike is ereg_replace can help me to do this. After writing one line of code I am happy it solve the purpose.
[a-zA-Z()] searches for all the occurences in the string and replace them with supplied character.
I very hardly uses ereg_replace but from now onwards I will encourage myself and others to use ereg_replace.