Explain ereg_replace and stuff

Alot of times I see functinos such as ereg_replace and preg_replace being used. Now, the PHP manual explains how to use them but it doesnt quite clarify how to use the string. Ive seen things like (+.?) or something used, and #msi, and Im confused! Someone feel like explaining or at least pointing me to a site?