[PHP] preg_replace problem

2009-06-13 Thread Al
This preg_replace() should simply replace all "&" with "&" unless the value is already "&" But; if $value is simple a quote character ["] I get ""e". e.g., "test" => "e;test"e; Search string and replace works as it should in Regex_Coach. echo $value.''; $value=preg_replace("%&(?!amp;)%i", "&

Re: [PHP] preg_replace problem (or possibly bug)

2006-03-08 Thread Anthony Ettinger
On 3/8/06, Michael <[EMAIL PROTECTED]> wrote: > I am currently writing a forum system, but at the moment I have a bug > that no one can seem to get to the root cause of. Basically I am using > preg_replace with the pattern as "'\[url=(.*?)\](.*?)\[/url\]'is". > However for most links it works fine

[PHP] preg_replace problem (or possibly bug)

2006-03-08 Thread Michael
I am currently writing a forum system, but at the moment I have a bug that no one can seem to get to the root cause of. Basically I am using preg_replace with the pattern as "'\[url=(.*?)\](.*?)\[/url\]'is". However for most links it works fine but for others it just doesn't render the bbcode to a

Re: [PHP] preg_replace problem

2006-03-01 Thread Chris
Benjamin Adams wrote: $file = dog.txt; $today = date("Ymd"); function incDate($new, $date){ //$date = settype('int'); return $new.($date++); } $getOldValue = parse_ini_file($file, 1); $newValue = $getOldValue[$today] + 1; $oldDate = $today . " = ". $newValue; $newDate = preg_rep

[PHP] preg_replace problem

2006-03-01 Thread Benjamin Adams
$file = dog.txt; $today = date("Ymd"); function incDate($new, $date){ //$date = settype('int'); return $new.($date++); } $getOldValue = parse_ini_file($file, 1); $newValue = $getOldValue[$today] + 1; $oldDate = $today . " = ". $newValue; $newDate = preg_replace('/(\d+\s\=\s)(\d+)

Re: [PHP] preg_replace problem

2003-06-24 Thread Wendell Brown
On Tue, 17 Jun 2003 07:25:00 -0400, Vincent Bouret wrote: >I want "A dog jumped over a ladder" to become "A dog jumped over >a ladder". How about this... $str = "A dog jumped over a ladder"; $str = preg_replace( "/(^| )(a)( |$)/i", "$1$2$3", str ); -- PHP General Mailing List (http://www.php

Re: [PHP] preg_replace problem

2003-06-17 Thread Stefan Dengscherz
Hello, \\1",$sourcestring); ?> should do the job. regards Am Die, 2003-06-17 um 13.25 schrieb Vincent Bouret: > Hi, > > I am having this problem with preg_replace. I want the following thing but I > can't understand what regular expression I should put. > > I want to replace all occurences o

Re: [PHP] preg_replace problem

2003-06-17 Thread Marek Kilimajer
You need \b = word boundary. $string=preg_replace("/\\b($word)\\b/i",'\1', $string); Vincent Bouret wrote: Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I should put. I want to replace all occurences of a given **whole**

[PHP] preg_replace problem

2003-06-17 Thread Vincent Bouret
Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I should put. I want to replace all occurences of a given **whole** word into a string. For example: I want "A dog jumped over a ladder" to become "A dog jumped over a ladde

[PHP] preg_replace problem.

2002-02-17 Thread Paul Roberts
where am i going wrong i used $mail = preg_replace("/]*?>/i","\n\n$0", $mail,-1); and $mail = preg_replace("/]*?>/i","\n\n\\1", $mail,-1); but i get $0 or \1 inserted, but only on the linux server not on my win 2000 dev machine! Paul Roberts [EMAIL PROTECTED] - Ori

Re: [PHP] preg_replace problem

2001-01-18 Thread Ignacio Vazquez-Abrams
On Thu, 18 Jan 2001, The Captain wrote: > I have a regular expression that's not giving me the results i really need. > > I have a bunch of strings coming at me that need to be truncated if they're > over 15 characters... but not to truncate until after it reaches the first > word. > > This regul

[PHP] preg_replace problem

2001-01-18 Thread The Captain
I have a regular expression that's not giving me the results i really need. I have a bunch of strings coming at me that need to be truncated if they're over 15 characters... but not to truncate until after it reaches the first word. This regular expression just doesn't seem to want to work 100%: