On Friday 07 January 2005 07:32, Fredrik Arild Takle wrote:
> I have a some problems doing a search and replace in a string.
> I want to replace:
>
> with
>
>
> Note ALT, src, border properties may come in random order.
>
> My solution today is a not good enough because I only do an eregi_replace
From: "Steve Buehler" <[EMAIL PROTECTED]>
> Thank you so much for this. I was thinking of it all wrong when
> doing this. I have a couple of other questions to go along with this.
> 1. How would I change this to do a recursive search for the .php files
> instead of just the *.php or *
At 11:27 AM 4/30/2004, John W. Holmes wrote:
From: "Steve Buehler" <[EMAIL PROTECTED]>
> #!/usr/bin/php
> $strtoreplace="require \"http://www.domain.com/";;
> $replacewithstring="require \"/home/domain/www/";
>
> replacestring();
>
> function replacestring(){
> GLOBAL $strtoreplace,$replacewithst
From: "Steve Buehler" <[EMAIL PROTECTED]>
> I am trying to write a script that will replace a string in a
> file. Actually, about 3000 files. And I am stuck. I can get the list of
> files, but then I pretty much become stuck. I wanted to try str_ireplace
> (not sure if that is what I should us
On Friday 23 April 2004 12:30, T UmaShankari wrote:
> I need to replace a character " with "\. Using php how to do this. i
> have given like this but it is giving parse error
>
> $temps=str_replace('"','"\',$temp);
>
> Can anyone tell me how to do this ?
Try:
$temps = str_replace('"','"\
ch Gray [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 28 maart 2003 12:39
Aan: Thijs Lensselink; [EMAIL PROTECTED]
Onderwerp: RE: [PHP] string replace problem!!
> Good day ,
>
> I have the following string.
> ,slideimages[0],slideimages[1],slideimages[2]
> Wich starts with a ',
> Good day ,
>
> I have the following string.
> ,slideimages[0],slideimages[1],slideimages[2]
> Wich starts with a ','. No my problem is i want to strip
> this first and only the first ','.
>
> i've tried
> $string = ",slideimages[0],slideimages[1],slideimages[2]";
> $string = preg_replace('/^./
www.php.net/str-replace
Awlad Hussain wrote:
I have a string with underscore in the middle.. like "This_That"
which function do i use to replace the _ with space? eg to "This That"
the string is in a variable..
I know its really simple but just don't know which function to use.
any suggestion?
There is many functions that can do it.
str_replace() is the fastest on thisone. preg_match() comes on second
position, and after that comes ereg_replace().
But if you need to do harder replacing, preg_match() is the one to use, imo.
Niklas
-Original Message-
From: Awlad Hussain [mailto
#x27;=> 'BOB', );
$OPENTAG = "<<";
$CLOSETAG = ">>";
print preg_replace( "/$OPENTAG(.*?)$CLOSETAG/e", '$ASSIGN[$1]', $text );
> -Original Message-
> From: Jeroen Olthof [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 16, 2001
$text = "Hello there, <>.
My name is <>";
$ASSIGN = array(test => "this is a test", 'name'=> 'BOB', );
$OPENTAG = "<<";
$CLOSETAG = ">>";
print preg_replace( "/$OPENTAG(.*?)$CLOSETAG/e", '$ASSIGN[$1]', $text );
prints:
Hello there, this is a test.
My name is BOB
To do what you want, throw
If you're looking to strip off just the file extension, you can use
pathinfo() to get that. I don't think it is a documented function, so
use var_dump(pathinfo($var)) to see what it outputs.
Tait Grove wrote:
>
> How can I strip everything past a certain character in a string?
>
> i.e.:
>
> $f
but you would have to count how many dots are there ...
-Original Message-
From: Gregor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 17, 2001 5:20 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] string replace
$foo = "test.gif";
$foo1 = substr($foo, 0, strpos($foo, &q
$foo = "test.gif";
$foo1 = substr($foo, 0, strpos($foo, "."));
this should work :)
gregor
""Tait Grove"" <[EMAIL PROTECTED]> wrote in message
002a01c07ff7$0dffee20$[EMAIL PROTECTED]">news:002a01c07ff7$0dffee20$[EMAIL PROTECTED]...
How can I strip everything past a certain character in a string
Here is a bad way to do it, but it works
Jerry Lake
-Original Message-
From: Tait Grove [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 16, 2001 12:01 PM
To: PHP GENERAL
Subject: [PHP] string replace
How can I strip everything past a certain character in a string?
i.e.:
$foo = "
You may want to try exploding on the ".":
$fooPieces = explode($foo, ".");
That way everything before the dot, is in the first piece of the array and
everything after is in the second part of the array. However this may cause
issues if filenames will contain dots. But if you follow an 8.3 or 8
16 matches
Mail list logo