Solved

ereg_replace error issue

Posted on 2011-09-14
2
305 Views
Last Modified: 2012-05-12
Hello,

I am getting this error:
Deprecated: Function ereg_replace() is deprecated in /var/ww...

with this line of code:
mysql_real_escape_string(ereg_replace("([0-9](-| |.))?(\(?[0-9]{3}\)?(-| |.)?)?[0-9]{3}(-| |.)?[0-9]{4}", "", $row['description']))

Open in new window


I tried to replace ereg_replace with preg_replace but I am getting this error:

Warning: preg_replace() [function.preg-replace]: Unknown modifier '?' in /va...
0
Comment
Question by:movieprodw
2 Comments
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 36536650
Use preg_replace instead (http://it2.php.net/preg_replace):

mysql_real_escape_string(preg_replace("#([0-9](-| |.))?(\(?[0-9]{3}\)?(-| |.)?)?[0-9]{3}(-| |.)?[0-9]{4}#", "", $row['description']))
0
 
LVL 1

Author Closing Comment

by:movieprodw
ID: 36536665
Thank you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question