I have the following str_replace code which takes a given comment string and replaces any instances with a dot followed by [++] with the word He with a capital letter. Otherwise it replaces with he with no capital letters.
$comment = str_replace(array(". [++]","[++]"), array(". He","he"), $comment);
Although this works in most cases. It doesnt work if my comment string has [++] tag in the beginning of the sentence or if the tag is after a line break or two. It only works if the dot is next to the tag.
Any ideas how I can get it to replace with the capital He if its after a line break or the first tag in beginning of the comment string?