Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ereg_replace error issue

Posted on 2011-09-14
2
Medium Priority
?
318 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 2000 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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…
Suggested Courses

782 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