Re: [PHP] str_replace to ignore commas

2004-01-06 Thread Chris Hayes
At 15:29 6-1-04, you wrote: I'm trying to use str_replace to ignore sertain characters from a recordset field and it seems I am having difficulties with ignoring commas and carriage returns. I've gotten the following but when searching for, let's say, New York. When York is at the end of a

Re: [PHP] str_replace to ignore commas

2004-01-06 Thread Vernon
could the problem be that you explode on so the phrase 'New York', having a space, is split up? Could be. Some times the New is on one line and the York is on the next line. I need for it to explode no matter what. How would I do that? For instance the print_r for the array shows me this in

Re: [PHP] str_replace to ignore commas

2004-01-06 Thread Chris Hayes
At 15:58 6-1-04, you wrote: could the problem be that you explode on so the phrase 'New York', having a space, is split up? Could be. Some times the New is on one line and the York is on the next line. I need for it to explode no matter what. How would I do that? For instance the print_r for

Re: [PHP] str_replace to ignore commas

2004-01-06 Thread Richard Davey
Hello Vernon, Tuesday, January 6, 2004, 2:29:31 PM, you wrote: V I'm trying to use str_replace to ignore sertain characters from a recordset V field and it seems I am having difficulties with ignoring commas and V carriage returns. I've gotten the following but when searching for, let's Nowhere

Re: [PHP] str_replace to ignore commas

2004-01-06 Thread Vernon
Nowhere in your replacement array do you check for, or remove, carriage returns. Add this \n to it: $replacement = array(\, \,, ., !, ?, \n); Your exploded array should now be correct. When I do this I get some really unexpected results. Almost everything comes up bold. -- PHP General

Re: [PHP] str_replace vs. preg_replace speed

2003-12-16 Thread David T-G
Shawn, et al -- ...and then Shawn McKenzie said... % % I will run some benchmarks (even though they may be flaky), but what would % be the fastest execution? ... % % Or, if I created one expression that handled all of the five $search items % (since they are similar) and used preg_replace()?

RE: [PHP] str_replace question

2003-09-10 Thread SLanger
preg_replace('/*\[a-z]+)[0-9]+(\)/', '$1$2', $String); Ok why not simply use reg_replace('/ques[0-9][0-9]/', '/ques/', $String); BTW preg regex are more powerfull since they support some stuff that the posix standard does not support. As far as I know lookbehinds and lookbacks and stuff like

RE: [PHP] str_replace question

2003-09-09 Thread Wouter van Vliet
$String = ques99; preg_replace('/*\[a-z]+)[0-9]+(\)/', '$1$2', $String); will most likeley do. Btw, does anybody know why preg_replace is adviced over ereg_replace in the manual? .. and if ereg_replace doesn't have any advantages over preg_replace, couldn't this function get depricated? -

RE: [PHP] str_replace question

2003-09-09 Thread Robert Cummings
I think (and don't quote me on this, and feel free to correct me :) that preg_replace() is fast being based on perl regular expressions. ereg_replace() however, follows the POSIX standard for regular expression matching. Cheers, Rob. On Tue, 2003-09-09 at 17:36, Wouter van Vliet wrote: $String

Re: [PHP] str_replace performance in large mailing script

2003-08-24 Thread David Otton
On Sun, 24 Aug 2003 14:42:01 +0200, you wrote: I have a mailing script that sends individualised mails to users(some users even get more than one mail). I have a template html mail file. I individualise this by using str_replace function. It is really slow. Can anyone point me to some

Re: [PHP] str_replace performance in large mailing script

2003-08-24 Thread David Otton
On Sun, 24 Aug 2003 15:38:13 +0100, you wrote: Second tip is that sprintf() should be faster than str_replace(). Compare: $text = Hello %s; $name = John; echo (str_replace (%s, $name, $text)); echo (sprintf ($text, $name)); Thinking about it, straight concatenation should be faster than

Re: [PHP] str_replace() problems actually *_replace() problems to be more accurate

2003-06-16 Thread Mark
--- Thomas Bolioli [EMAIL PROTECTED] wrote: I am a perl/java/c++ programmer who is doing something in php and have run accross something I am stumped with. I am trying to replace carriage returns with br or p tags (p's in groups of two and br's for any unmatched cr's). I have tried all

Re: [PHP] str_replace() problems actually *_replace() problems to bemore accurate

2003-06-16 Thread Lars Torben Wilson
On Mon, 2003-06-16 at 11:49, Thomas Bolioli wrote: I am a perl/java/c++ programmer who is doing something in php and have run accross something I am stumped with. I am trying to replace carriage returns with br or p tags (p's in groups of two and br's for any unmatched cr's). I have tried

Re: [PHP] str_replace() problems actually *_replace() problems tobe

2003-06-16 Thread Thomas Bolioli
Thanks, I was so hung up on the regex that I failed to spot the (obscenely) obvious through my tunnel vision. Sometimes a fresh pair of eyes makes all the difference. Anyhow, the understatement of the day award goes to Lars for There's only one thing you didn't try... ;-) Thanks again, Tom

Re: [PHP] str_replace() problem

2003-03-31 Thread Kevin Stone
- Original Message - From: Ren Fournier [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Monday, March 31, 2003 1:52 PM Subject: [PHP] str_replace() problem I am performing a str_replace() on a large string, and everything works fine, except that two of the elements I'm searching for

RE: [PHP] str_replace() problem

2003-03-31 Thread Johnson, Kirk
You could replace the longer one, Blueberry, first. Then, the only remaining occurrences of Blue will be ones that you really want. Kirk I am performing a str_replace() on a large string, and everything works fine, except that two of the elements I'm searching for (and replacing) have

Re: [PHP] str_replace() problem

2003-03-31 Thread Marcus Rasmussen
Just change the order and do the search and replace on Blueberry before doing it on Blue. Ei: str_replace(Blueberry,Strawberry,$paragraph); str_replace(Blue,Red,$paragraph); or: str_replace(array(Blueberry, Blue), array(Strawberry, Red), $paragraph);

RE: [PHP] str_replace an include

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
There a few ways of doing this but the following is one of the easier and quickest off the top of my head. If you know the name of the tag and the include this will work if you don't or want it to be dynamic you will need to have some reg for the following. (how are you getting the $string)? //

RE: [PHP] str_replace

2002-12-26 Thread John W. Holmes
In using str_replace, I glanced at the manual and found that it can take arrays for it's arguments. Great! I thought that I could have a single search string, an array of replacement vars, and no subject. It would then replace each successive instance of the search string with the next

Re: [PHP] str_replace

2002-12-26 Thread Weston Houghton
okey dokey, here goes: this gets really complicated to explain without showing the code, which I really can't do (damned NDA's) and ultimately it's a bit big to post anyhow. But I'm going to try. I let the user specify a number of rows to input 2 pieces of data. I then replace a template

RE: [PHP] str_replace

2002-10-31 Thread Thoenen, Peter Mr. EPS
try $file = preg_replace(/[[:punct:][:space:]]/,'',$file); PEter -Original Message- From: rick [mailto:rick;somers.net] Sent: Friday, November 01, 2002 00:22 To: [EMAIL PROTECTED] Subject: [PHP] str_replace How could this be written better? Is there a way to do it all in 1

Re: [PHP] str_replace

2002-10-31 Thread Jonathan Sharp
$del = array(' ', ', '\\', '/'...etc); foreach ( $del AS $d ) { $file = str_replace($d, '', $file); } -js rick wrote: How could this be written better? Is there a way to do it all in 1 line? $file = str_replace( , , $file); $file = str_replace(', , $file); $file = str_replace(\\, ,

Re: [PHP] str_replace

2002-10-31 Thread Rasmus Lerdorf
Folks, read the docs please. You can simply pass an array directly to str_replace() and do this in a single str_replace() call. -Rasmus On Thu, 31 Oct 2002, Jonathan Sharp wrote: $del = array(' ', ', '\\', '/'...etc); foreach ( $del AS $d ) { $file = str_replace($d, '', $file); } -js

Re: [PHP] str_replace question

2002-04-16 Thread Andrey Hristov
preg_replace('/\d+/','',$the_string); Hope this helps. Andrey - Original Message - From: Andras Kende [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 16, 2002 4:29 AM Subject: [PHP] str_replace question Is a nicer way to remove any number 1-0 from a string???

Re: [PHP] str_replace question

2002-04-15 Thread Justin Blake
Andras Kende [EMAIL PROTECTED] wrote: Is a nicer way to remove any number 1-0 from a string??? Currently: $metakeywords=str_replace(1,'',strtolower($metakeywords)); $metakeywords=str_replace(2,'',strtolower($metakeywords)); $metakeywords=str_replace(3,'',strtolower($metakeywords));

Re: [PHP] str_replace binary safe??

2001-10-22 Thread DL Neil
Hi folks, following problem appeared on PHP 3.0.16 on LINUX I have a binary file, where I want to replace some letters I do the following: $filename = xyz.sdc; $fd = fopen( $filename, r+b ); // also tried r $x=filesize( $filename ); // this shows the correct filesize 22528 byte $contents

Re: [PHP] str_replace binary safe??

2001-10-22 Thread Oliver Heinisch
At 22.10.01 21:36, you wrote: Hi folks, following problem appeared on PHP 3.0.16 on LINUX I have a binary file, where I want to replace some letters I do the following: $filename = xyz.sdc; $fd = fopen( $filename, r+b ); // also tried r $x=filesize( $filename ); // this shows the

Re: [PHP] str_replace binary safe??

2001-10-22 Thread DL Neil
following problem appeared on PHP 3.0.16 on LINUX I have a binary file, where I want to replace some letters I do the following: $filename = xyz.sdc; $fd = fopen( $filename, r+b ); // also tried r $x=filesize( $filename ); // this shows the correct filesize 22528 byte

Re: [PHP] str_replace and arrays

2001-09-06 Thread * RzE:
Original message From: Gerard Samuel [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 01:10:15AM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] str_replace and arrays Hey all. Im trying to reduce some lines of code that has muliple lines of str_replace. I figure lets try using arrays but

RE: [PHP] str_replace() function help

2001-08-28 Thread J Friesen
This is the code I use for articles that are taken out of a database and the \n need to be changed to paragraphs $art = htmlspecialchars($art); $art = nl2br($art); $art = str_replace(br /, /pp, $art); echo p . $art . /p; -Original Message- From: Navid Yar [mailto:[EMAIL PROTECTED]]

RE: [PHP] str_replace() function help

2001-08-28 Thread Navid Yar
: Tuesday, August 28, 2001 11:07 AM To: Navid Yar Cc: Php-General@Lists. Php. Net Subject: RE: [PHP] str_replace() function help This is the code I use for articles that are taken out of a database and the \n need to be changed to paragraphs $art = htmlspecialchars($art); $art = nl2br($art); $art

Re: [PHP] str_replace

2001-01-31 Thread Jason Murray
Augusto Cesar Castoldi wrote: In the begin of my site, I have the following code: ? $buffer = str_replace("%99", $total, $buffer); ? And somewhere on html tag I write %99. I pretend to replace the %99 with $total. Why it doesn't work? When I publish my site appears the %99 on screen,

Re: [PHP] str_replace

2001-01-31 Thread Philip Olson
Because you must replace it after $total and $buffer are defined, not before. This works : ?php $total = 'foo'; $buffer = 'blah blah %99 blah blah'; $buffer = str_replace('%99', $total, $buffer); print $buffer; ? This does not work : ?php $buffer =

<    1   2