Highlight the keyword code design ideas in search results! Keywords have been divided into words. Workaround

Source: Internet
Author: User
Tags key string
Highlight the keyword code design ideas in search results! Keywords have been divided into words.
such as search: "Xu Jinglei"
Split into: "Xujing" "Static Bud" two words

Do not discuss the effect of the word segmentation module, how do you highlight in the search results "xujing" "Static Bud", because with Str_replace to do, the first time to replace the "xujing", it becomes such as "xujing", then the second time to find "static Lei", because "quiet" and "lei" word between "", So I couldn't find it.

Do not know how to solve this piece, ask for ideas or code, thank you.

------Solution--------------------
Preg_replace (array, array, string)
------Solution--------------------
such as search: "Xu Jinglei"
Split into: "Xujing" "Static Bud" two words

"Xujing", the starting seat in "Xu Jinglei" and the cheap amount for (0,2)
"Jing Lei", the starting seat and the cheap amount for "Xu Jinglei"
--After merging (0,3)


------Solution--------------------
Preg_replace (array,array,string);??
This can't be solved, right?
------Solution--------------------
Method is the same as replacing the key string, just iterating through the array of participle
------Solution--------------------
Support the upstairs

I think Maxthon's highlight keyword looks like this.
------Solution--------------------
Write a function of your own.
System functions are unlikely to be estimated.

------Solution--------------------
What is the output of the replacement? How can we replace the contents of the search?
------Solution--------------------
Concern...
------Solution--------------------
Collection
  • 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.