How do I mark the specified string in the webpage as red? Dear God, I want to mark a character string in the output string with a space followed by a red string. do you have any suggestions? I wrote it in PHP. All key strings can be obtained. For example, the source string is I & nbsp; come & nbsp; from & nbsp; China! & Nbsp; what I want is that I know the key word "come", but I don't know the from behind it. How can I mark the specified string in the webpage as red?
Dear God, I want to mark a character string in the output string with a space followed by a red string. do you have any suggestions? I wrote it in PHP. All key strings can be obtained. For example, the source string is I come from China! What I want is that I know the key word "come", but I don't know the from behind it. I want to Red both come and from! I don't know. do you have any good ideas?
------ Solution --------------------
$ S = 'I come from China! ';
Echo preg_replace ('/come \ s \ w +/', '$ 0', $ s );
I come from China!