регулярное выражение в php для поиска слов - PullRequest
1 голос
/ 01 марта 2010

я хочу код для следующего примера ....

пример ....

$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 .....

спасибо

Ответы [ 2 ]

2 голосов
/ 01 марта 2010

Вас может заинтересовать Sphinx API , если вы хотите поступить как настоящие поисковые системы.

1 голос
/ 01 марта 2010

использовать preg_match_all, последний параметр выдает результат в зависимости от предоставленного шаблона. Вы можете предоставить константу вместо шаблона регулярного выражения!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...