OK, I have a section of code with things like:
Text
I need to reformat thes
You want to read about Regular Expressions because you will need them sooner or later anyway. If you do not mind about the content of the href property, then you can use:
s/]*)?>([^<]+)<\/a>/\1<\/b>/
The part between the first // searches for the opening tag (either alone or with some parameters, in this case a white space \s is required to avoid matching
See also PHP’s preg_replace function. The final expression would then look like this (tested):
preg_replace('/]*)?>([^<]+)<\/a>/i', '\\1', 'Text');