Re: very quick Regex query

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

 



On 1 March 2011 03:07, Alexis <phplists1@xxxxxxxxxxxxxxx> wrote:
> Hi,
>
> I know not strictly a PHP question, but was just wondering if someone can
> tell me the regex format for something please.
>
> I need to replace
> ......
> with
> --------
> That is six periods replaced by eight hyphens.
>
> Many thanks
> Alexis
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

$text = preg_replace('/\.{6}/', '--------', $text)

but

$text = str_replace('......', '--------', $text);

is going to quicker.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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