help with preg_replace()
- From: "heath" <guyemup@xxxxxxxxx>
- Date: 5 Oct 2005 15:30:30 -0700
are conditional subpatterns not allowed in the replacement string of
preg_replace()? i don't see it in the docs anywhere but my regex is
not giving me what i thought it should:
function pluralize( $singular )
{
$pattern = "/^(\w+?)(?:([^aeiou])y|(x|s|z|sh|ch|[^aeiou]o)|)$/";
$replacement = "\\1(?(2)\\2ie|\\3e)s";
echo preg_replace( $pattern, $replacement, $singular, 1 );
}
this outputs the conditional syntax literally. is it just not allowed
or am i missing something syntactically? thanks!
heath
.
- Prev by Date: preg_replace help
- Next by Date: Re: put a lot of items in a shopping cart at once
- Previous by thread: preg_replace help
- Next by thread: PHP_INI_PERDIR on Windows
- Index(es):