Re: very quick Regex query
| From: | Richard Quadling | Date: | Tue, 01 Mar 2011 10:26:30 +0000 |
| Subject: | Re: very quick Regex query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311603@lists.php.net to get a copy of this message | ||
On 1 March 2011 03:07, Alexis <phplists1@antonakis.co.uk> 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