473,387 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ereg/preg replace

190 100+
Want to replace the field

D:\\Program Files\\xampp\\htdocs\\sample

into

D:\Program Files\xampp\htdocs\sample

I tryed lot using ereg/preg replace but not suceed.....

help......
Apr 7 '08 #1
1 2103
code green
1,726 Expert 1GB
It is probably because you have not escaped the backslashes
(and double backslashes)
str_replace() should be ok for this task
Expand|Select|Wrap|Line Numbers
  1. $str = str_replace('\\','\',$str);
Apr 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: bonehead | last post by:
Greetings, I'd like to add somee error handling to a password field: if the password is fewer than 5 characters or greater than 15 characters I'd like to trap it. Special characters such as ^...
3
by: Rafal Zak | last post by:
I have a little problem with ereg (eregi) in PHP - in some cases it behaves differently than I expect and I don`t know if my expectations are strange or there is any "syntax subtlety" I have...
1
by: JD | last post by:
I have a blog type script, I would like to make it automaticly parse img files in the blog entry somehow (ie; If I put "http://www.test.com/me.jpg" it will parse it as "<img...
4
by: Nel | last post by:
Hi all, I am struggling with understanding a small eregi problem in php4. My code: <?PHP $htmlsource = '<img src="pics/hotdog.gif"> text text <img src="pics/silly%20sausage.gif"> ';...
18
by: yawnmoth | last post by:
Say I have the following script: <? $string = 'test'; if (eregi("^+$",$string)) { echo 'matches!'; } else {
4
by: ollie.mitch | last post by:
Hi, I need two ereg expressions in my PHP code. One of them needs to check that a string only contains letters, and the other needs to check that the string only contains letters and commas...
11
by: Fabri | last post by:
I searched and tried to develop (with no luck) a function to do the following: I have a string that may be: "Le'ts go to <a href="my.htm">my car</a>. Tomorrow I'll have to buy a new car. My...
11
by: Bruno Rafael Moreira de Barros | last post by:
I have a file with <html><head><meta something...><meta something else...>. I need to remove that text. I would use str_ireplace, but the contents of the two metas change with the file. I...
2
by: JanDoggen | last post by:
function vldLicense($lic) { echo "called with lic: ". $lic . "<br>"; echo preg_match('', $lic) . "<br>"; if (preg_match('{4}-{4}-{4}-{4}', $lic) == 0) return false; return true; } gives me:
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.