RE: [PHP] ereg_replace to preg_replace translation

2009-08-11 Thread Ford, Mike
> -Original Message- > From: m a r k u s [mailto:queribus2...@hotmail.com] > Sent: 11 August 2009 15:34 > > I see that from PHP 5.3.0 ereg_replace() function is deprecated and > throws a warning. > I would like to use the preg_replace() function as an alternative of > ereg_replace() functi

Re: [PHP] ereg_replace to preg_replace translation

2009-08-11 Thread Shawn McKenzie
m a r k u s wrote: > Hi all, > > I see that from PHP 5.3.0 ereg_replace() function is deprecated and > throws a warning. > I would like to use the preg_replace() function as an alternative of > ereg_replace() function but... can't undestand the "\n#[^\n]*\n" > expression. > > $sql = ereg_replace(

[PHP] ereg_replace to preg_replace translation

2009-08-11 Thread m a r k u s
Hi all, I see that from PHP 5.3.0 ereg_replace() function is deprecated and throws a warning. I would like to use the preg_replace() function as an alternative of ereg_replace() function but... can't undestand the "\n#[^\n]*\n" expression. $sql = ereg_replace("\n#[^\n]*\n", "", $sql); Any he

Re: [PHP] ereg_replace with user defined function?

2006-10-11 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-11 14:28:21 +0200: > Actually, - believe it or not - I have never written a class (I am > still learning PHP after three years working with that language). So > I am not quite sure of the benefits of your class. Nevermind then. I don't know how to fit my exper

Re: [PHP] ereg_replace with user defined function?

2006-10-11 Thread Frank Arensmeier
Thanks again for your suggestions. Actually, - believe it or not - I have never written a class (I am still learning PHP after three years working with that language). So I am not quite sure of the benefits of your class. One thing I do realise is the benefit of replacing the foreach loop w

Re: [PHP] ereg_replace with user defined function?

2006-10-11 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-11 09:52:51 +0200: > > 10 okt 2006 kl. 19.25 skrev Roman Neuhauser: > > ># [EMAIL PROTECTED] / 2006-10-09 22:01:34 +0200: > >>Thank you Ilaria and Roman for your input. I did not know that preg > >>is able to deal with PCRE patterns. > > > >"preg" is obviously sh

Re: [PHP] ereg_replace with user defined function?

2006-10-11 Thread Frank Arensmeier
10 okt 2006 kl. 19.25 skrev Roman Neuhauser: # [EMAIL PROTECTED] / 2006-10-09 22:01:34 +0200: Thank you Ilaria and Roman for your input. I did not know that preg is able to deal with PCRE patterns. "preg" is obviously short for "Perl REGular expressions", while PCRE positively means

Re: [PHP] ereg_replace with user defined function?

2006-10-10 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-09 22:01:34 +0200: > Thank you Ilaria and Roman for your input. I did not know that preg > is able to deal with PCRE patterns. "preg" is obviously short for "Perl REGular expressions", while PCRE positively means Perl-Compatible Regular Expressions. The

Re: [PHP] ereg_replace with user defined function?

2006-10-09 Thread Frank Arensmeier
Thank you Ilaria and Roman for your input. I did not know that preg is able to deal with PCRE patterns. As a matter of fact I came up with the following solution (if someone is interested): the function takes a text and an array with converters like: $converters[] = array ( "metric" => "mm",

Re: [PHP] ereg_replace with unser defined function?

2006-10-09 Thread Ilaria De Marinis
Hi Frank, I think preg_replace_callback is a good solution for you. If you don't want to use it, you can construct two arrays defining matches and replacements. For example: $matches [230] [120] [340] $replacements [9.1] [replace2] [replace3] After you stored matches in $matches using regu

Re: [PHP] ereg_replace with unser defined function?

2006-10-09 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-09 09:46:01 +0200: > Is it possible to have a user defined function for the replacement > within an ereg_replace (like preg_replace_callback)? I am working on > a script that converts html pages with metric data into imperial > data. My script takes text strings

[PHP] ereg_replace with unser defined function?

2006-10-09 Thread Frank Arensmeier
Hello all. Is it possible to have a user defined function for the replacement within an ereg_replace (like preg_replace_callback)? I am working on a script that converts html pages with metric data into imperial data. My script takes text strings containing one or more instances of e.g. "

Re: Re[2]: [PHP] ereg_replace help

2004-03-18 Thread trlists
On 18 Mar 2004 Richard Davey wrote: > Nope, because in the only reference book I had to hand it said the ^ > matched the start of a string so it didn't occur to me to try it. > > Thanks to John I now know when used in a block it's no longer limited > to the start of the string. The code you poste

Re[2]: [PHP] ereg_replace help

2004-03-18 Thread Richard Davey
Hello Chris, Thursday, March 18, 2004, 3:28:01 PM, you wrote: CH> did you try CH> $output = ereg_replace('[^[:alnum:]]', '', $string); CH> ? Nope, because in the only reference book I had to hand it said the ^ matched the start of a string so it didn't occur to me to try it. Thanks to John I no

Re: [PHP] ereg_replace help

2004-03-18 Thread Chris Hayes
At 16:21 18-3-04, you wrote: I can do the reverse with: $output = ereg_replace('[[:alnum:]]', '', $string); Which will happily remove all alpha-numeric characters from $string! But I want it to remove anything but.. suggestions please? did you try $output = ereg_replace('[^[:alnum:]]', '', $st

Re: [PHP] ereg_replace help

2004-03-18 Thread John W. Holmes
From: "Richard Davey" <[EMAIL PROTECTED]> > I'm sure this is blindingly simple, but could anyone tell me how to > get an ereg_replace() to return a string where all characters OTHER > than alpha-numerics have been stripped out? $output = ereg_replace('[^a-zA-Z0-9]','',$string); The ^ is NOT (whe

[PHP] ereg_replace help

2004-03-18 Thread Richard Davey
Hi all, I'm sure this is blindingly simple, but could anyone tell me how to get an ereg_replace() to return a string where all characters OTHER than alpha-numerics have been stripped out? I can do the reverse with: $output = ereg_replace('[[:alnum:]]', '', $string); Which will happily remove al

Re: [PHP] ereg_replace -- Thanks!

2004-02-10 Thread Nicole Lallande
Many thanks!! Richard Davey wrote: Hello Nicole, Tuesday, February 10, 2004, 5:55:01 PM, you wrote: NL> Can anyone tell me why this does not work: NL> $str1=ereg_replace("index.php?src=","index/",$url); Because it's an invalid regular expression. NL> is there another way to do this? Yes, str_

Re: [PHP] ereg_replace

2004-02-10 Thread Richard Davey
Hello Nicole, Tuesday, February 10, 2004, 5:55:01 PM, you wrote: NL> Can anyone tell me why this does not work: NL> $str1=ereg_replace("index.php?src=","index/",$url); Because it's an invalid regular expression. NL> is there another way to do this? Yes, str_replace() for something this simple:

Re: [PHP] ereg_replace

2004-02-10 Thread Jason Wong
On Wednesday 11 February 2004 01:55, Nicole Lallande wrote: > Can anyone tell me why this does not work: > > $str1=ereg_replace("index.php?src=","index/",$url); Because '.' and '?' have special meanings in a regex. > is there another way to do this? If it's a plain simple string replace you want

[PHP] ereg_replace

2004-02-10 Thread Nicole Lallande
Can anyone tell me why this does not work: $str1=ereg_replace("index.php?src=","index/",$url); is there another way to do this? Thanks, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) T

RE: [PHP] ereg_replace help

2003-11-18 Thread Martin Towell
> * Thus wrote Martin Towell ([EMAIL PROTECTED]): > > Hi All, > > > > I have an array of strings in the following format: > > "abcd - rst" > > "abcd - uvw" > > "abcd - xyz" > > "foobar - rst" > > "blah - rst" > > "googol - uvw" > > > > What I want to do is strip everything

Re: [PHP] ereg_replace help

2003-11-18 Thread Curt Zirzow
* Thus wrote Martin Towell ([EMAIL PROTECTED]): > Hi All, > > I have an array of strings in the following format: > "abcd - rst" > "abcd - uvw" > "abcd - xyz" > "foobar - rst" > "blah - rst" > "googol - uvw" > > What I want to do is strip everything from the "

Re: [PHP] ereg_replace help

2003-11-18 Thread Robert Cummings
On Tue, 2003-11-18 at 02:30, Jason Wong wrote: > On Tuesday 18 November 2003 13:37, Martin Towell wrote: > > > I have an array of strings in the following format: > > "abcd - rst" > > "abcd - uvw" > > "abcd - xyz" > > "foobar - rst" > > "blah - rst" > > "googol - uvw" > > >

Re: [PHP] ereg_replace help

2003-11-18 Thread Henrik Hudson
On Monday 17 November 2003 23:37, Martin Towell <[EMAIL PROTECTED]> sent a missive stating: > Hi All, > > I have an array of strings in the following format: > "abcd - rst" > "abcd - uvw" > "abcd - xyz" > "foobar - rst" > "blah - rst" > "googol - uvw" > > What I

Re: [PHP] ereg_replace help

2003-11-18 Thread Jason Wong
On Tuesday 18 November 2003 13:37, Martin Towell wrote: > I have an array of strings in the following format: > "abcd - rst" > "abcd - uvw" > "abcd - xyz" > "foobar - rst" > "blah - rst" > "googol - uvw" > > What I want to do is strip everything from the " - " b

Re: [PHP] ereg_replace help

2003-11-18 Thread Eugene Lee
On Tue, Nov 18, 2003 at 04:37:52PM +1100, Martin Towell wrote: : : I have an array of strings in the following format: : "abcd - rst" : "abcd - uvw" : "abcd - xyz" : "foobar - rst" : "blah - rst" : "googol - uvw" : : What I want to do is strip everything from t

[PHP] ereg_replace help

2003-11-17 Thread Martin Towell
Hi All, I have an array of strings in the following format: "abcd - rst" "abcd - uvw" "abcd - xyz" "foobar - rst" "blah - rst" "googol - uvw" What I want to do is strip everything from the " - " bit of the string to the end, _but_ only for the strin

Re: [PHP] ereg_replace()

2003-11-15 Thread erythros
chris and justin, you guys rock. thanx for pointing towards str_replace(). my code works now. thanx! "Justin French" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sunday, November 16, 2003, at 02:31 PM, erythros wrote: > > > ok, so i'm stupid. how do i replace all '? ' with '??

Re: [PHP] ereg_replace()

2003-11-15 Thread Justin French
On Sunday, November 16, 2003, at 02:31 PM, erythros wrote: ok, so i'm stupid. how do i replace all '? ' with '?? ' No need for regular expressions here. Unless you want ANY white space (\n, \t, etc) instead of just spaces, an ereg would be better. I prefer preg_replace(): Justin French

Re: [PHP] ereg_replace()

2003-11-15 Thread Chris Shiflett
--- erythros <[EMAIL PROTECTED]> wrote: > ok, so i'm stupid. how do i replace all '? ' with '?? ' $foo = '? '; $bar = str_replace('? ', '?? ', $foo); Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook

[PHP] ereg_replace()

2003-11-15 Thread erythros
ok, so i'm stupid. how do i replace all '? ' with '?? ' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] ereg_replace vs. preg_replace [was: str_replace question]

2003-09-10 Thread Wouter van Vliet
thanks, that pretty much cleared things up.. -> -Oorspronkelijk bericht- -> Van: Curt Zirzow [mailto:[EMAIL PROTECTED] -> Verzonden: woensdag 10 september 2003 6:30 -> Aan: [EMAIL PROTECTED] -> Onderwerp: Re: [PHP] ereg_replace vs. preg_replace [was: str_repla

Re: [PHP] ereg_replace vs. preg_replace [was: str_replace question]

2003-09-09 Thread Curt Zirzow
* Thus wrote Wouter van Vliet ([EMAIL PROTECTED]): > > 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? I've done some testing with ereg and preg fu

Re: [PHP] ereg_replace

2003-07-01 Thread Dean E. Weimer
> I'm trying to replace singel line comment with empty string. > > tried ereg_replace("//.+\n",'',$string); but this replaces all text after > //. > > anyone now what to do? \n is the newline character, making the string apear to be multiple lines see the thread "[PHP] multi line regular express

[PHP] ereg_replace

2003-07-01 Thread alexander sundli
I'm trying to replace singel line comment with empty string. tried ereg_replace("//.+\n",'',$string); but this replaces all text after //. anyone now what to do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] ereg_replace and quotation marks

2003-06-25 Thread Paul Nowosielski
PHP might take you tomorrow. > > > -Original Message- > From: Paul Nowosielski [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 24, 2003 8:45 PM > To: [EMAIL PROTECTED] > Subject: [PHP] ereg_replace and quotation marks > > > I'm trying to strip quotat

RE: [PHP] ereg_replace and quotation marks

2003-06-24 Thread Boaz Yahav
PROTECTED] Subject: [PHP] ereg_replace and quotation marks I'm trying to strip quotation marks out of user from input but it doesn't seem to work correctly. $string=ereg_replace("\"","",$string); I get a \ mark after I run a quote through the form. When I wan

[PHP] ereg_replace and quotation marks

2003-06-24 Thread Paul Nowosielski
I'm trying to strip quotation marks out of user from input but it doesn't seem to work correctly. $string=ereg_replace("\"","",$string); I get a \ mark after I run a quote through the form. When I want the quote turned to nothing. Any suggestions?? Paul -- PHP General Mailing List (http:/

[PHP] ereg_replace question

2003-06-11 Thread Todd Cary
I have a string, D:\Htdocs\gilardi\barcode\php\testwrite.php from   $fullpath = $HTTP_SERVER_VARS[PATH_TRANSLATED]; I want to remove the "testwrite.php" leaving D:\Htdocs\gilardi\barcode\php\ This does not work   $fullpath = $HTTP_SERVER_VARS[PATH_TRANSLATED];   $fullpath = ereg_replace(

Re: [PHP] ereg_replace();

2002-11-13 Thread Gustaf Sjoberg
Ah, very nice Ernest. thanks a lot. the nice thing is that i read and understood the regexp so i got a great deal out of having this problem ;-) cheers, GS On Wed, 13 Nov 2002 08:28:30 +0100 [EMAIL PROTECTED] (Ernest E Vogelsinger) wrote: >At 01:59 13.11.2002, Gustaf Sjoberg said: >---

Re: [PHP] ereg_replace();

2002-11-12 Thread Ernest E Vogelsinger
At 01:59 13.11.2002, Gustaf Sjoberg said: [snip] >hi, >i tried to implement the code, but it does not work if the string: > >a) doesnt contain any .. >b) doesnt contain any >c) doesnt contain any >d) contains multiple ..'s > >so i altered it a little and th

Re: [PHP] ereg_replace();

2002-11-12 Thread Gustaf Sjoberg
hi, i tried to implement the code, but it does not work if the string: a) doesnt contain any .. b) doesnt contain any c) doesnt contain any d) contains multiple ..'s so i altered it a little and this is what i came up with: )(.*?)(<\/pre>)(.*)/is', $string)) { if (!preg

Re: [PHP] ereg_replace();

2002-11-12 Thread Ernest E Vogelsinger
At 18:44 12.11.2002, Gustaf Sjoberg spoke out and said: [snip] >many thanks, and kudos for the quick reply. i will try that right away! > >as a sub-question, do you mind telling me where you learned regexp? i've >been searching google all day with no luck, i

Re: [PHP] ereg_replace();

2002-11-12 Thread Gustaf Sjoberg
many thanks, and kudos for the quick reply. i will try that right away! as a sub-question, do you mind telling me where you learned regexp? i've been searching google all day with no luck, i've just find more or less basic regexp guides. did you learn through practice or do you have a secret sou

Re: [PHP] ereg_replace();

2002-11-12 Thread Ernest E Vogelsinger
At 17:49 12.11.2002, Gustaf Sjoberg spoke out and said: [snip] >Hi, >i'm trying to replace every instance of "" within the ".." >tags. i want all other breakrows to remain the same. > >i've tried numerous regular expressions, but i can't find a way to just

[PHP] ereg_replace();

2002-11-12 Thread Gustaf Sjoberg
Hi, i'm trying to replace every instance of "" within the ".." tags. i want all other breakrows to remain the same. i've tried numerous regular expressions, but i can't find a way to just replace the breakrows.. it replaces _everything_ bewteen and . example $string: test test test testing t

Re: [PHP] ereg_replace???

2002-10-28 Thread Shawn McKenzie
Thanks! Why does preg_replace("^\W^","",$str); not remove undescores _ ? Are they alpha-numeric? I had to do this preg_replace("^\W|_^","",$str); TIA, Shawn "John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:000201c27eab$f4ea0500$7c02a8c0@;coconut... > > I need to replace all NON alpha

RE: [PHP] ereg_replace???

2002-10-28 Thread John W. Holmes
> I need to replace all NON alpha-numeric characters in a string. > > Example: >input: "-What's Up Doc?" >output: "WhatsUpDoc" > > I received this in a previous post, but it doesn't work: >$str = ereg_replace("/[^[:alnum:]]/i", '', $str); Use preg_replace() with that string, not ere

[PHP] ereg_replace???

2002-10-28 Thread Shawn McKenzie
I need to replace all NON alpha-numeric characters in a string. Example: input: "-What's Up Doc?" output: "WhatsUpDoc" I received this in a previous post, but it doesn't work: $str = ereg_replace("/[^[:alnum:]]/i", '', $str); Thanks! Shawn -- PHP General Mailing List (http://www.ph

[PHP] ereg_replace()

2002-08-14 Thread Liam MacKenzie
Hi guys, I'm looking to get a specific bit of data out of a slightly complex amount of data. Ok, I have this in a variable: User : [EMAIL PROTECTED] Dir : /home/eXtremail/mbox/i-redlands.net/3/1/liam Forward : Copy : Account mapping : User Disk Quota : 0 Disk Space Us

Re: [PHP] ereg_replace problems

2002-05-22 Thread Analysis & Solutions
Zac: > $cntnt = eregi_replace("\[L=([a-zA-Z]+)]"."([a-zA-Z]+)\[EL]", > "\\2", $cntnt); Put "\\1" in double quotes so it gets evaluated as a substring. "\\2", $cntnt); Enjoy, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | For

[PHP] ereg_replace problems

2002-05-22 Thread Zac Hillier
I'm trying to replace values within a string with a value looked up from a database. I have a function that looks up the value in the database for me but I'm having trouble passing the value to the function because of the backslashes, is there a way around this? Code: $cntnt = eregi_replace(

Re: [PHP] ereg_replace or chr bug?

2002-03-28 Thread Ando
ot;), which is not the > same as chr(45). > Hence, ereg_replace() fails and simply returns the original string, $text. > > -Original Message- > From: Ando [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 28, 2002 7:08 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] e

RE: [PHP] ereg_replace or chr bug?

2002-03-28 Thread Rick Emery
sage- From: Ando [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 7:08 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] ereg_replace or chr bug? Not sure what you mean here $text= ereg_replace('&#([0-9]+);' , chr('\1') , $text); should replace for example "A&qu

Re: [PHP] ereg_replace or chr bug?

2002-03-28 Thread Ando
m the manual for chr() > > Returns a one-character string containing the character specified by ascii. > > It replaces one (1) character, not a string > > -Original Message- > From: Ando [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 28, 2002 6:59 AM > To: [EMAIL PRO

RE: [PHP] ereg_replace or chr bug?

2002-03-28 Thread Rick Emery
>From the manual for chr() Returns a one-character string containing the character specified by ascii. It replaces one (1) character, not a string -Original Message- From: Ando [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 6:59 AM To: [EMAIL PROTECTED] Subject: [

[PHP] ereg_replace or chr bug?

2002-03-28 Thread Ando
Ok, what i wanna do is replace the codes in html with ascii equivalents: $text= ereg_replace('&#([0-9]+);' , chr('\1') , $text); But somehow it doesnt work, i have no idea why. When i use $text= ereg_replace('&#([0-9]+);' , '\1' , $text); it replaces everything correctly But $text= ereg_replace

[PHP] ereg_replace Help

2002-03-21 Thread lists
Hi all, I have a large file that I am trying to parse. I have a many lines that look like this \\text1 I need an expression that will change \\text1 to text1= so if I have something like this \\text1 asdfkjaslkfj asdlfkjasljkf asdlkfjasldfkj asldkfjalskfj \\text2 erweiurwoeir werqwer qw

Re: [PHP] ereg_replace

2002-02-18 Thread Erik Price
On Monday, February 18, 2002, at 03:44 PM, Mitch Tishaw wrote: > I need a little help with the ereg_replace function. I have the > following code: > > $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]"," href=\"\\0 > \">\\0", $text); > > which pads a url with an href tag to mak

[PHP] ereg_replace

2002-02-18 Thread Mitch Tishaw
I need a little help with the ereg_replace function. I have the following code: $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","\\0", $text); which pads a url with an href tag to make it clickable. Here's what I would like to do: In the case of the url ending with .gif or

RE: [PHP] ereg_replace help

2002-02-04 Thread Lars Torben Wilson
- > From: John P. Donaldson [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 04, 2002 4:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] ereg_replace help > > > I'm not actually replacing \n with , I just used > that as an example. When I tried Martin's s

Re: [PHP] ereg_replace help

2002-02-03 Thread Jason Wong
On Monday 04 February 2002 13:31, John P. Donaldson wrote: > I'm not actually replacing \n with , I just used > that as an example. When I tried Martin's solution, I > got a parse error on this line: > > $content = implode($lines, "\n",); You've got a trailing comma. -- Jason Wong -> Gremlins

RE: [PHP] ereg_replace help

2002-02-03 Thread Martin Towell
y around Martin -Original Message- From: John P. Donaldson [mailto:[EMAIL PROTECTED]] Sent: Monday, February 04, 2002 4:32 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] ereg_replace help I'm not actually replacing \n with , I just used that as an example. When I tried Martin's solutio

Re: [PHP] ereg_replace help

2002-02-03 Thread John P. Donaldson
t; instead > > ... > > > > $lines = file("filename_here.blah"); // read in > file as an array > > $content = implode("", $lines); // join it > all back together > > fopen(...); fputs(..., $content); fclose(...); > > > > > > hop

Re: [PHP] ereg_replace help

2002-02-03 Thread Mike Frazer
gt; > -Original Message- > From: John P. Donaldson [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 04, 2002 3:39 PM > To: php > Subject: [PHP] ereg_replace help > > > I have a file open and can successfully write to it, > but I was to be able to search for a cer

RE: [PHP] ereg_replace help

2002-02-03 Thread Martin Towell
sage- From: John P. Donaldson [mailto:[EMAIL PROTECTED]] Sent: Monday, February 04, 2002 3:39 PM To: php Subject: [PHP] ereg_replace help I have a file open and can successfully write to it, but I was to be able to search for a certain string of text and replace it with a string of text. I can

[PHP] ereg_replace help

2002-02-03 Thread John P. Donaldson
I have a file open and can successfully write to it, but I was to be able to search for a certain string of text and replace it with a string of text. I can't figure out how to construct a proper ereg_replace statement to search through this file and do the replacing. Examples I've seen are in t

Re: [PHP] EREG_REPLACE?

2001-11-15 Thread Mark
On Thu, 15 Nov 2001 20:09:08 +0100, Oosten, Sjoerd van wrote: > >> Hello, ive got a problem >> >> I want to replace this string: >> this must also be variable >> >> by: >> >> this must also be variable try: ereg_replace("(.*)", "\\1",$string); >> So the two tags should be placed before and after

[PHP] EREG_REPLACE?

2001-11-15 Thread Oosten, Sjoerd van
> Hello, ive got a problem > > I want to replace this string: > this must also be variable > > by: > > this must also be variable > > So the two tags should be placed before and after the link when a link is > in my $pagecontent > > I know it's easier to use another class, but for the moment

Re: [PHP] ereg_replace - How do I stop it being "greedy"?

2001-09-07 Thread George Whiffen
ok into the s modifier...it makes a dot match a newline as well, where > normally it wouldn't > > jack > > -Original Message- > From: George Whiffen [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 1:09 PM > To: [EMAIL PROTECTED] > Subject:

RE: [PHP] ereg_replace - How do I stop it being "greedy"?

2001-09-07 Thread Jack Dempsey
look into the s modifier...it makes a dot match a newline as well, where normally it wouldn't jack -Original Message- From: George Whiffen [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 1:09 PM To: [EMAIL PROTECTED] Subject: [PHP] ereg_replace - How do I stop it

[PHP] ereg_replace - How do I stop it being "greedy"?

2001-09-07 Thread George Whiffen
Hi, I've got a problem with regular expression syntax with ereg_replace: ereg_replace(':start:(.*):end:','this is \\1',':start: first :end: middle :start: last :end:'); returns - this is first :end: middle :start: last but I want - this is first middle this is last The problem seems t

Re: [PHP] ereg_replace

2001-07-25 Thread Rasmus Lerdorf
Use the urlencode() function. Or at the very least use str_replace. And by the way, the ereg_replace() you have works fine. You must be doing something silly. -Rasmus On Wed, 25 Jul 2001, Clayton Dukes wrote: > > > Can someone tell me why this doesn't work? > > $home_street = ereg_replace ("

Re: [PHP] ereg_replace

2001-07-25 Thread Jason Stechschulte
On Wed, Jul 25, 2001 at 11:38:41AM -0400, Clayton Dukes wrote: > Can someone tell me why this doesn't work? Not really. You should tell us why it isn't working, and we can help you to get it working. What is happening? What is all of the relevant code? > $home_street = ereg_replace (" " , "+"

Re: [PHP] ereg_replace

2001-07-25 Thread Matt Greer
on 7/25/01 10:38 AM, Clayton Dukes at [EMAIL PROTECTED] wrote: > > > Can someone tell me why this doesn't work? > > $home_street = ereg_replace (" " , "+" , $home_street); > > The input is "123 happy trail" > I need the output to be "123+happy+trail" Not exactly what you wanted, but you coul

[PHP] ereg_replace

2001-07-25 Thread Clayton Dukes
Can someone tell me why this doesn't work? $home_street = ereg_replace (" " , "+" , $home_street); The input is "123 happy trail" I need the output to be "123+happy+trail" Thanks, Clayton

[PHP] ereg_replace

2001-07-04 Thread Marc Logemann
Hi, short question: i want to use ereg_replace to replace something with an array-element, this is my code and its not working: ereg_replace("<\\$([0-9])>", "\$parmarray[\\1]", $string); parmarray is of course an array with some elements, Here are the facts: $parmarray = array ("", "value1",

Re: [PHP] ereg_replace

2001-04-24 Thread J. Jones
On Tue, Apr 24, 2001 at 06:21:20PM -0400, Wade wrote: > I am attempting to do an ereg_replace(), but the charachter I want to > replace is a \. Any Ideas how I make the following work? > > $F_name = ereg_replace ("\", "", $acc_fname); > echo $F_name; > > Thanks, > Wade > use \\ -- PHP Ge

[PHP] ereg_replace

2001-04-24 Thread Wade
I am attempting to do an ereg_replace(), but the charachter I want to replace is a \. Any Ideas how I make the following work? $F_name = ereg_replace ("\", "", $acc_fname); echo $F_name; Thanks, Wade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTE

Re: [PHP] ereg_replace: Help!

2001-04-23 Thread Plutarck
This works: $str = ''; echo eregi_replace("", "Replaced", $str); -- Plutarck Should be working on something... ...but forgot what it was. "Erica Douglass" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have one ereg_replace problem that I cannot seem t

[PHP] ereg_replace: Help!

2001-04-23 Thread Erica Douglass
I have one ereg_replace problem that I cannot seem to fix. I need to delete an IMG tag. The only thing I know about this tag is that it will contain SRC="images/headers in the string. Here is an example: I tried this, but it didn't work: $contents = ereg_replace ("", "", $contents); Can s

Re: [PHP] ereg_replace: Replacing only first occurrence

2001-04-23 Thread ~~~i LeoNid ~~
On 23 Apr 2001 13:04:36 -0700 impersonator of [EMAIL PROTECTED] ("Erica Douglass") planted &I saw in php.general: >I want to only replace the first occurrence of a string in a file using >ereg_replace. Should I use a loop to do this? Any suggestions? Please email >me at [EMAIL PROTECTED] with sug

[PHP] ereg_replace: Replacing only first occurrence

2001-04-23 Thread Erica Douglass
I want to only replace the first occurrence of a string in a file using ereg_replace. Should I use a loop to do this? Any suggestions? Please email me at [EMAIL PROTECTED] with suggestions. Thanks, Erica -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTE

Re: [PHP] ereg_replace

2001-02-15 Thread Robin Vickery
> "VB" == "Brian V Bonini" <[EMAIL PROTECTED]> writes: > Ok, but I thought the start and end chars were ^ $ i.e., ^is$ or is > this not what you mean by bounderies? No, not really. \b matches the start or end of a word. You can see it clearly if you do this: print preg_replace( '/\b/'

RE: [PHP] ereg_replace

2001-02-15 Thread Brian V Bonini
>> [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 15, 2001 > >> 10:57 AM To: [EMAIL PROTECTED]; Robin Vickery; > >> [EMAIL PROTECTED] Subject: Re: [PHP] ereg_replace > >> > > >> > $string = preg_replace( > >> >

Re: [PHP] ereg_replace

2001-02-15 Thread Robin Vickery
, 2001 >> 10:57 AM To: [EMAIL PROTECTED]; Robin Vickery; >> [EMAIL PROTECTED] Subject: Re: [PHP] ereg_replace >> >> > $string = preg_replace( >> > array( '/is/', '/string/'), >> >

RE: [PHP] ereg_replace

2001-02-15 Thread Brian V Bonini
Ah right, strings not words, I feel like a dummy now... ;-) > -Original Message- > From: John Vanderbeck [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 15, 2001 10:57 AM > To: [EMAIL PROTECTED]; Robin Vickery; [EMAIL PROTECTED] > Subject: Re: [PHP] ereg_replace >

Re: [PHP] ereg_replace

2001-02-15 Thread John Vanderbeck
> why does this > > $string = "this is my string."; > > print $string . "\n"; > > $string = preg_replace( > array( '/is/', '/string/'), > array( 'is not', 'bit of text' ), > $string > ); > > print $s

RE: [PHP] ereg_replace

2001-02-15 Thread Brian V Bonini
PROTECTED]] > Sent: Wednesday, February 14, 2001 5:05 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] ereg_replace > > > >>>>> ""VB" == "Brian V Bonini" <[EMAIL PROTECTED]> writes: > > > I know you can replace A or B or

RE: [PHP] ereg_replace

2001-02-14 Thread Brian V Bonini
That's exactly what I want to do Thanks! > -Original Message- > From: Robin Vickery [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 14, 2001 5:05 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] ereg_replace > > > >>>>> "&q

Re: [PHP] ereg_replace

2001-02-14 Thread Robin Vickery
> ""VB" == "Brian V Bonini" <[EMAIL PROTECTED]> writes: > I know you can replace A or B or C with D but can you replace A > with B and C with D exclusively with one call to ereg_replace or > does this need to be done seperately? With ereg_replace it must be done seperately, but if you use

RE: [PHP] ereg_replace

2001-02-13 Thread Maxim Maletsky
nesday, February 14, 2001 5:31 AM To: PHP Lists Subject: [PHP] ereg_replace I know you can replace A or B or C with D but can you replace A with B and C with D exclusively with one call to ereg_replace or does this need to be done seperately? -Brian -- PHP General Mailing List (http://www.ph

[PHP] ereg_replace

2001-02-13 Thread Brian V Bonini
I know you can replace A or B or C with D but can you replace A with B and C with D exclusively with one call to ereg_replace or does this need to be done seperately? -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

Re: [PHP] ereg_replace with assoc array?

2001-02-08 Thread Jaxon
Thanks for the feedback! >From the docs it appears that I can do this: $string = file.tpl; //html mixed with {placeholders} $array = fetch_mysql_array($result, MYSQL_ASSOC); //array of field => values echo strtr($string, $array); //passing only 2 arguments means 2nd is array one thing - I wa

[PHP] ereg_replace with assoc array?

2001-02-08 Thread Jaxon
Hi Can I do this $string = file.tpl; while (list($pattern, $replacement) = each($array)) { ereg_replace ($pattern, $replacement, $string); } echo $string; note some assumptions below: $array contains an assoc array: first foo second bar third rab fourth oof file.tpl is this: some

Re: [PHP] ereg_replace all items in a array

2001-01-29 Thread Jeff Warrington
In article <[EMAIL PROTECTED]>, "Joseph H Blythe" <[EMAIL PROTECTED]> wrote: What is happening is that you are replacing the variable $replaced on each iteration of the while loop. As a result, $replaced is only storing the most recent match. To see this, try this out: $keywords = "foo"; $data

[PHP] ereg_replace all items in a array

2001-01-29 Thread Joseph H Blythe
G'day PHP'ers I am trying highlight the results from a search, so far I have this working but only if the string is an exact match ie: case sensitive, for example: " . $val . ""; $replaced = ereg_replace($val, $hilite, $data); } echo $replaced; ?> Now as metioned this seems to work only for "