Blockquote
$var=‘I have many Delimeters, i.e. 123D, abcD, 9D, goodD, badD, and good185007D’;
echo str_replace(‘D’,‘NumericDelimeter’,$var);
The code above produces the result below.
Blockquote
I have many Delimeters, i.e. 123NumericDelimeter, abcNumericDelimeter, 9NumericDelimeter, goodNumericDelimeter, badNumericDelimeter, and good185007NumericDelimeter
I like to change numberic and delimeter only.
my target result is the following…
Blockquote
I have many Delimeters, i.e. 123NumericDelimeter, abcD, 9NumericDelimeter, goodD, badD, and good185007NumericDelimeter
Well no it wouldnt, because it would replace the D in “Delimeters” with “NumericDelimeter” and you’d end up with I have many NumericDelimeterelimeters, i.e. 123NumericDelimeter, abcNumericDelimeter, 9NumericDelimeter, goodNumericDelimeter, badNumericDelimeter, and good185007NumericDelimeter
What you’re trying to reference is a preg_replace call, rather than a str_replace one.