Re: strip out too many newlines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't know much about the app you're writing, but does this do the trick for
you?

echo preg_replace ('!
                     (
                      \[quote
                      (?:=[^\]]*)?
                      \]
                     )                # Capture the [quote=xxx] part
                   
                     \n*            # Eliminate any extra newlines here
                   
                     (.+)            # Get contents
                   
                     \n*            # Eliminate any extra newlines here
                   
                     (\[/quote\])    # Capture this part
                   
                     \n*            # Eliminate any extra newlines here
                   
                    !x', "\$1\$2\$3\n\n", $string);

HTH,


Marco

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/4/05 9:44 AM, "Sebastian" <sebastian@xxxxxxxxxxxxxxxxxxx> wrote:

> [quote=user]
> foo
> [/quote]
> 
> <bunch of extra lines>
> 
> more text...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux