Sent: Thursday, December 06, 2001 5:13 PM
To: Jack Dempsey; PHP list
Subject: RE: [PHP] Reg ex help-Removing extra blank spaces before HTML
output
OK, this time the \n worked. The only thing I changed was using /
delimiters instead of | delimiters in the search string. No idea if/why
that would a
OK, this time the \n worked. The only thing I changed was using / delimiters instead
of | delimiters in the search string. No idea if/why that would affect anything in
the replacement string.
Anyway, I finally came up with exactly what I wanted:
preg_replace(array("/\s*\n+\s*/", "/[ ]+/"), ar
]
Sent: Thursday, December 06, 2001 1:56 PM
To: Jack Dempsey
Subject: RE: [PHP] Reg ex help-Removing extra blank spaces before HTML
output
At 11:41 AM 12/6/01 -0500, Jack Dempsey wrote:
>using "\n" as your replacement text will do ithowever, if you want a
>newline in the html, then
gular expressions as well.its worth the money
jack
-Original Message-
From: Ken [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 06, 2001 3:08 AM
To: Jack Dempsey; liljim; PHP list
Subject: RE: [PHP] Reg ex help-Removing extra blank spaces before HTML
output
At 02:43 PM 12
At 02:43 PM 12/5/01 -0500, Jack Dempsey wrote:
>$t = preg_replace('/\s+/',' ',$text);
One more thing:
How do I replace with newline instead of a space? I read through the manuals but
couldn't grasp how to do this. \n didn't cut it.
And, more advanced -
The above replaces any groups of 2 or m
sday, December 05, 2001 2:01 PM
To: Jack Dempsey
Subject: RE: [PHP] Reg ex help-Removing extra blank spaces before HTML
output
At 10:57 AM 12/5/01 -0500, Jack Dempsey wrote:
>a space (\s is from perl)
Ah, OK, yours doesn't deal with newlines.
From list member "James", a solution
5, 2001 5:18 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Reg ex help-Removing extra blank spaces before HTML
output
Hello,
The example Jack gave you will clear up spaces well, though to get both
newlines and spaces into one:
$input = preg_replace("/([ ]|\n){1,}/", "\\1", $inpu
Hello,
The example Jack gave you will clear up spaces well, though to get both
newlines and spaces into one:
$input = preg_replace("/([ ]|\n){1,}/", "\\1", $input);
James
"Jack Dempsey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> $text = preg_replace('|\
$text = preg_replace('|\s+|',' ',$text);
-Original Message-
From: Ken [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 05, 2001 2:06 AM
To: PHP list
Subject: [PHP] Reg ex help-Removing extra blank spaces before HTML
output
I want to remove all superfluous blank spaces before I sent
9 matches
Mail list logo