NYCPHP Meetup

NYPHP.org

[nycphp-talk] Regular expression for Google-like search

Stephen Musgrave stephen at musgrave.org
Wed Oct 12 12:15:54 EDT 2005


Great!

Thanks for the push!

On Oct 10, 2005, at 4:33 PM, Flavio daCosta wrote:

> How about:
>
> $search_string = '"the color purple" movie soundtrack';
> $search_terms = array();
> $search_terms = preg_match_all ('/"[^"]+"|\w+/', $search_string, 
> $matches);
>
> print_r ($matches);
>
>
> Array
> (
>     [0] => Array
>         (
>             [0] => "the color purple"
>             [1] => movie
>             [2] => soundtrack
>         )
>
> )
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>
>




More information about the talk mailing list