I'm looking to replace the 'nth' instance of an expression within a string.
Example (very simple)-
$string=My mom can beat up your mom and your mom's dog;
$pattern=mom;
$replacement=dad;
I want to be able to replace any particular instance of the pattern
within that string. I was getting ready
I'm looking to replace the 'nth' instance of an expression within a string.
Example (very simple)-
$string=My mom can beat up your mom and your mom's dog;
$pattern=mom;
$replacement=dad;
I want to be able to replace any particular instance of the pattern
within that string. I was getting ready
From: Thaddeus J. Quintin [EMAIL PROTECTED]
I'm looking to replace the 'nth' instance of an expression within a
string.
Example (very simple)-
$string=My mom can beat up your mom and your mom's dog;
$pattern=mom;
$replacement=dad;
I want to be able to replace any particular instance of
From: Thaddeus J. Quintin [EMAIL PROTECTED]
I'm looking to replace the 'nth' instance of an expression within a
string.
Example (very simple)-
$string=My mom can beat up your mom and your mom's dog;
$pattern=mom;
$replacement=dad;
I want to be able to replace any particular instance of
Perfect solution.
Thanks, I don't know how I overlooked the preg_replace_callback
function. That's exactly what I needed.
Thaddeus
CPT John W. Holmes wrote:
From: Thaddeus J. Quintin [EMAIL PROTECTED]
I'm looking to replace the 'nth' instance of an expression within a
string.
Example (very
5 matches
Mail list logo