簡體   English   中英

php中的正則表達式用於查找單詞

[英]regex in php for finding words

我想要以下示例的代碼....

例....

$words = "The sculpture was selected during a design competition. After 
    Kapoor's design was chosen, numerous technological concerns regarding 
    the design's construction and assembly arose, in addition to concerns 
    regarding the sculpture's upkeep and maintenance. Various experts were 
    consulted, some of whom believed the design could not be implemented. 
    Eventually, a feasible method was found, but the sculpture's construction 
    fell behind schedule. It was unveiled in an incomplete form during the 
    Millennium Park grand opening  celebration in 2004, before being concealed 
    again while it was completed. Cloud Gate was formally dedicated on 
    May 15, 2006, and has since gained considerable popularity, both 
    domestically and internationally.";

我搜索的單詞是“設計一些大公園”

我需要搜索詞中的前三十個詞。 像google搜索結果頁面.....

謝謝

如果您想像真正的搜索引擎一樣,您可能會對Sphinx API感興趣。

使用preg_match_all,最后一個參數根據所提供的模式為您提供結果。 您可以提供常量字符串而不是正則表達式模式!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM