473,320 Members | 1,867 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,320 software developers and data experts.

Replacing a symbol throught a file

I am reading in a file and I want to go through and change the punctuation
to spaces before I continue with the rest of my regexprs. I have tried using
preg_replace() and str_replace() and substr_replace() but I can't seem to
get it right. Any help would be greatly appreciated.

$any is what I want to replace, $space is what I want to replace it with and
$html is file I read in.

preg_replace($any, $space, $html);
Jul 17 '05 #1
4 3146
> ...but I can't seem to
get it right.
That's a pretty detailed description. Could you please explain us a
little bit more...
preg_replace($any, $space, $html);


It works fine - provided that $any is valid pattern and $space is a
replace string that works for you ...and that $html is the right string.

Well... can you imagen one of us is able to help you, if we have no
more information than the function you used?
Jul 17 '05 #2
What I am doing is running each line of a file through multiple
preg_match_all that DO work. What I want to do before I do that though is
change all the = signs into spaces (for example). When I said it doesn't
work right I mean I don't know which function is designed to do that. It has
to take all of the = signs out of a string AND substring and replace with a
space. Is there something like a preg_replace_all?? (I know that doesn't
exist I looked but something that would do that?)

Thanks
Jul 17 '05 #3
Kelly wrote:
It has
to take all of the = signs out of a string AND substring and replace with a
space. Is there something like a preg_replace_all?? (I know that doesn't
exist I looked but something that would do that?)


What are substrings? Aren't substrings included in the main string
where you want to replace your '=', e.g.?

$str = str_replace("="," ",$str); replaces _all_ '=' he founds with a
space. There won't be any '=' omitted.
Well, you can do it by using preg_replace("/=/"," ",$str) or
eregi_replace("/=/"," ",$str), too, but is will give you exactly the
same result.

Now... what's the problem?
Jul 17 '05 #4
Thanks that worked.
"Paul Wellner Bou" <pa**********@united-scripts.com> wrote in message
news:c1*************@ID-205474.news.uni-berlin.de...
Kelly wrote:
It has
to take all of the = signs out of a string AND substring and replace with a space. Is there something like a preg_replace_all?? (I know that doesn't
exist I looked but something that would do that?)


What are substrings? Aren't substrings included in the main string
where you want to replace your '=', e.g.?

$str = str_replace("="," ",$str); replaces _all_ '=' he founds with a
space. There won't be any '=' omitted.
Well, you can do it by using preg_replace("/=/"," ",$str) or
eregi_replace("/=/"," ",$str), too, but is will give you exactly the
same result.

Now... what's the problem?

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rutger Claes | last post by:
How do I stop the SAX parser from replacing entities such as &#xE3; and &#xA9;. When I use &gt; and a default_handler, the default_handler is called and I can just print the data. Entities as &#xA9;...
1
by: Nguyen Thanh Danh | last post by:
I'm a student, i try search on Internet but i can't find any sample how to send file throught socket, between 2 computer! Please help me! Thanks!
3
by: Ney André de Mello Zunino | last post by:
Hello. I would appreciate if somebody could assist me with an error message I am getting from the Microsoft WinDbg 6.3 debugging tool. I am not familiar with it, since I have just downloaded it....
3
by: Olav | last post by:
Hi all, I can not install CF 2.0 SP 1 on an Symbol PPT8800 running WinCE 4.2. The Install-Log say's cgacutil.exe failed with exit-code 80000004 and I get a messagebox indicating a support-Info...
0
by: Tor Inge Rislaa | last post by:
Replacing character with ASCII code (HTML) Is it possible to replace a given character or symbol with it's ASCII code within a <ptag in HTML code. TIRislaa
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
7
Thekid
by: Thekid | last post by:
Hi, I need to search through a given file and find certain keys and replace them, in this case it's the symbol "%". I'm not sure how to go about this. f = open("numbers.txt","r") contents =...
12
by: ramesh54 | last post by:
Hello All, I have a test file z.txt with following lines *transformation X Y Z 10 20 30 Finally i need to have a the same text files as follows,
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.