I want to replace the
</color='#any hexadecimal color code '>
to
</color>
I have tried following but nothing happened
$bio_info="some string </color='#any hexadecimal color code'>";
preg_replace("/</color/", "</color>", $bio_info);
Your regexp doesn't include the ='#any hexadecimal color code ' part of the tag that you want to replace. You also forgot to escape the /. And you need to assign the result to a variable if you want to use it.
$bio_info="some string </color='#any hexadecimal color code'>";
$result = preg_replace('#</color=[^>]*>#', '</color>', $bio_info);
I've used a different regexp delimiter so I don't need to escape the /. [^>]* will match any sequence of characters other than >, so this matches the rest of the tag.
/.