首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >php中用于查找单词的正则表达式

php中用于查找单词的正则表达式
EN

Stack Overflow用户
提问于 2010-03-01 17:11:06
回答 2查看 108关注 0票数 1

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

示例...

代码语言:javascript
复制
$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.";

我刚才搜索的词是“设计一些宏伟的公园”

我需要搜索单词中的前30个单词。就像谷歌搜索结果页面.....

谢谢

EN

回答 2

Stack Overflow用户

发布于 2010-03-01 17:26:12

如果你想像真正的搜索引擎一样,你可能会对Sphinx API感兴趣。

票数 2
EN

Stack Overflow用户

发布于 2010-03-01 17:16:13

使用preg_match_all,最后一个参数根据提供的模式给出结果。您可以提供常量字符串而不是正则表达式模式!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2354744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档