$var = preg_replace(/\n*/,\n,$var);
Jason Caldwell [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Is there an elegant way to remove excess blank lines from my form data?
For example; if someone enters the following text and then press' the
Submit button:
replace that with
$var = preg_replace(/\n+/,\n,$var);
Bb [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
$var = preg_replace(/\n*/,\n,$var);
Jason Caldwell [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Is there an elegant way
neither worked. any other suggestions?
Bb [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
replace that with
$var = preg_replace(/\n+/,\n,$var);
Bb [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
$var =
$var = preg_replace(/[\r\n]+/,\n,$var);
Jason Caldwell [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
neither worked. any other suggestions?
Bb [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
replace that with
$var =
$strMine = preg.replace(/(\r\n|\r|\n)+/,$strMine,\r\n\r\n);
or \n\n as the replace.. :)
I use the (\r\n|\r|\n) to match against windows, unix, mac line
terminations... I usually replace with the windows \r\n
--
===
Michael
would suggest /(\r\n|\r|\n)+/ especially if the input is from a
browser that could be mac, or windows.. :)
--
===
Michael J. Ryan - tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net
6 matches
Mail list logo