RE: [PHP] ereg issues
| From: | ..s.c.o.t.t.. [gts] | Date: | Thu, 10 May 2001 17:04:12 +0000 |
| Subject: | RE: [PHP] ereg issues | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52323@lists.php.net to get a copy of this message | ||
print preg_replace('/(.*?)(\w{2})(.*)/', '\\2', $blah);
works for:
$blah = "*9 scott 777zxsdf";
and
$blah = "scott";
> -----Original Message-----
> From: Jerry Lake [mailto:jerryl@europa.com]
> Subject: [PHP] ereg issues
>
> I'm feeling a bit stupid today
> how do I truncate a string to the
> first two [a-zA-Z] characters ?
>
> this sure isn't working
> <snip>
> $test = "jerry";
> $test = ereg_replace("^\w*", "^[a-zA-Z]{2}" ,$test);
> </snip>