Solved

ereg_replace error issue

Posted on 2011-09-14
2
301 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
.htaccess 5 35
Scope of $_SESSION 17 39
Sending an image to a php webservice via cURL from command line 7 29
Insert won't work due to space in column name 5 20
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 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