Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread Thaddeus J. Quintin
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 (v

Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread CPT John W. Holmes
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 particu

Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread CPT John W. Holmes
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 parti

[PHP] iterative regular expression replacement

2003-08-19 Thread Thaddeus J. Quintin
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

[PHP] Iterative regular expression replacement

2003-08-19 Thread Thaddeus J. Quintin
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