On 12/9/05, Julien Bonastre <[EMAIL PROTECTED]> wrote:
<snip>
> http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blarge&st=post&sb%5B%5D=*&maxres=25&ob=datetime&ot=DESC
>
<snip>
>
> All I did was conjure up a regular expression that basically just matches 
> words :-) haha ironically..
>
>
> Here it is:
>
>   $extract_result="";
>   preg_match_all("/((?:[\w]+ ?){0,5})[\w 
> \.\,\-\;]((?:".join("|",$q_arr)."))([\w]*)[\w \.\,\-\;]((?:[\w]+ 
> ?){0,5})/i",$row["content"],$ext_matches,PREG_SET_ORDER);
>   foreach($ext_matches as $ext_arr) {
>     $extract_result .= $ext_arr[1]." <B>".$ext_arr[2]."</B>".$ext_arr[3]." 
> ".$ext_arr[4]." ... ";
>   }
>
>
> Are you familiar with regex?
>
<snip>

I'm not very familiar with regex at all and was wondering if you could
tell me how your regex would handle two matched search strings that
exist within a few words of each other in the text. For example "A
larger server would be sufficient I think".

Also in the link you provided (reproduced below) the first matched
word is surrounded by 4 words and the second by 5 words, is there a
reason for this?

"An example of a larger post can be found ... we were to add a
sufficient amount of text than we ..."

Thank you.

--
Graham

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to