Re: regular expression adaptation
| From: | David Robley | Date: | Fri, 27 Oct 2000 05:50:25 +0000 |
| Subject: | Re: regular expression adaptation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22273@lists.php.net to get a copy of this message | ||
On Fri, 27 Oct 2000, Cody Caughlan wrote:
> Hello,
>
> I have a Perl regexp that I need to implement in PHP, how would I do the
> following in PHP:
>
> (perl code)
>
> $str =~ s/(\w{$len})/$1-<BR>/g
>
> this code inserts a hyphen and html newline every $len characters in
> string $str.
>
> I looked at ereg() and its kin but could not see a suitable way to do
> this.
>
> Thanks in advance
> /Cody Caughlan
How about the perl-compatible regex functions?
http://www.php.net/manual/ref.pcre.php
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA