How to mark the specified string in the webpage as Red

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.